Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16277
| Message-ID | <1491996.ypRVEqgRn5@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2012-09-30 20:43 +0200 |
| Subject | Re: document.elementname vs document.getElementById("id") |
| Newsgroups | comp.lang.javascript |
| References | <k47drn$q7j$1@dont-email.me> <k48a8p$he5$1@speranza.aioe.org> <k48ubc$ab6$1@dont-email.me> <k4a1v3$fm9$1@speranza.aioe.org> |
| Followup-To | comp.lang.javascript |
Followups directed to: comp.lang.javascript
J.R. wrote: > Em 30-09-2012 05:02, Jukka K. Korpela escreveu: >> 2012-09-30 5:20, J.R. wrote: >>> You may use the W3C Markup Validation Service to check if an element >>> should have an ID. >> How would you do that? The id attribute is not *required* in any version >> of HTML. > > That's why I referred to the "W3C Validator", because it can tell if an > ID attribute is required or not. As has been said before, an `id' attribute is *never* *declared* #REQUIRED on *any* element type of *any* version of HTML or XHTML. You do not *have* *to* specify that attribute for Valid markup per se. As a result, a markup validator can tell you that a specified `id' attribute or attribute value is _not_ Valid on an element because the element type does _not_ have that attribute declared or the value _cannot_ be produced by the grammar production for the attribute type. It can tell you that if you refer to an ID in the markup (such as with the `for' attribute) that a corresponding ID was missing in the document. And it can tell you that there are duplicate IDs, because that makes the document not Valid. That is *different* from its telling you that you have not put an `id' attribute when you should have, these use-cases aside. More importantly, a *markup* validator parses your script code as CDATA or PCDATA. It is oblivious of the requirements of the Document *Object* Model API. It cannot tell you that you should have used an `id' attribute instead of or in addition to a `name' attribute because that was state-of-the-art now. You would need a DOM validator (or a competent person) for that. > Besides, W3C Validator works with XHTML pages too. That much is true. However the W3C Validator cannot tell you how XHTML is parsed by a real user agent such as a Web browser. It is oblivious of the different rendering modes as well. >>> Interestingly, Firefox still allows references in the old way >>> (document.elementID or formName.elementName) when a page is rendered in >>> "quirks mode". >> >> You are confusing support to document.foobar (when accessing a <form> >> element that has name="foobar") with issues like making id attribute >> values properties of the document object. The topic is confusing enough >> without such distractions. > > I think that Denis McMahon was dealing exactly with this problem: using > document.formname to identify forms (please reread his first post). Since both document.all.foo and document.foo apply both to elements with `id' and `name' "foo", and there is no markup in the OP, your assumption is not supported by the OP. Dennis may have simply chosen the wrong tool for the job. Please trim your quotes to the relevant minimum and get a real name. PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
document.elementname vs document.getElementById("id") Denis McMahon <denismfmcmahon@gmail.com> - 2012-09-29 18:15 +0000
Re: document.elementname vs document.getElementById("id") Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-29 22:17 +0200
Re: document.elementname vs document.getElementById("id") dann90038@gmail.com - 2012-09-29 16:21 -0700
Re: document.elementname vs document.getElementById("id") "J.R." <groups_jr-1@yahoo.com.br> - 2012-09-29 23:20 -0300
Re: document.elementname vs document.getElementById("id") "J.R." <groups_jr-1@yahoo.com.br> - 2012-09-29 19:53 -0700
Re: document.elementname vs document.getElementById("id") "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-09-30 11:02 +0300
Re: document.elementname vs document.getElementById("id") Denis McMahon <denismfmcmahon@gmail.com> - 2012-09-30 13:10 +0000
Re: document.elementname vs document.getElementById("id") Denis McMahon <denismfmcmahon@gmail.com> - 2012-09-30 13:14 +0000
Re: document.elementname vs document.getElementById("id") "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-09-30 17:20 +0300
Re: document.elementname vs document.getElementById("id") Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-09-30 21:09 +0200
Re: document.elementname vs document.getElementById("id") "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-09-30 22:28 +0300
Re: document.elementname vs document.getElementById("id") Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-09-30 21:53 +0200
Re: document.elementname vs document.getElementById("id") Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-30 21:53 +0200
Re: document.elementname vs document.getElementById("id") Denis McMahon <denismfmcmahon@gmail.com> - 2012-09-30 22:07 +0000
Re: document.elementname vs document.getElementById("id") "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-10-01 06:23 +0300
Re: document.elementname vs document.getElementById("id") Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-01 08:11 +0000
Re: document.elementname vs document.getElementById("id") Stefan Weiss <krewecherl@gmail.com> - 2012-10-01 11:25 +0200
Re: document.elementname vs document.getElementById("id") "J.R." <groups_jr-1@yahoo.com.br> - 2012-09-30 15:10 -0300
Re: document.elementname vs document.getElementById("id") Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-30 20:43 +0200
Re: document.elementname vs document.getElementById("id") Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-30 12:22 +0200
Re: document.elementname vs document.getElementById("id") "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-09-30 13:44 +0300
Re: document.elementname vs document.getElementById("id") Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-30 13:46 +0200
Re: document.elementname vs document.getElementById("id") Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-30 20:10 +0100
csiph-web