Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16266
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!news2.arglkargh.de!news.karotte.org!uucp.gnuu.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="ISO-8859-1" |
| Message-ID | <1835562.mW7zK3R6x3@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Sun, 30 Sep 2012 12:22:54 +0200 |
| User-Agent | KNode/4.4.11 |
| Content-Transfer-Encoding | 7Bit |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| 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> |
| Followup-To | comp.lang.javascript |
| MIME-Version | 1.0 |
| Lines | 78 |
| NNTP-Posting-Date | 30 Sep 2012 12:22:56 CEST |
| NNTP-Posting-Host | d2aefec6.newsspool1.arcor-online.net |
| X-Trace | DXC=H>3=];<I<53n`gW2MTm]<3ic==]BZ:af>4Fo<]lROoR1nkgeX?EC@@01CEWAg0_HN5DZm8W4\YJN<R=i2=[N6Y6:C6U0El@Glm6IU>1UjV_2l4 |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | csiph.com comp.lang.javascript:16266 |
Followups directed to: comp.lang.javascript
Show key headers only | View raw
J.R. wrote:
> On 29/09/2012 15:15, Denis McMahon wrote:
>> I'm arguing to replace using document.formname to identify forms with
>> assigning an id to the forms involved and using document.getElementById
>> ("formid").*, but the best arguments I can think of at the moment (more
>> robust to future changes, better compatibility with developing standards,
>> more maintainable) are butting up against "don't fix it until it needs
>> fixing", whereas I prefer to prevent future breakage, rather than react
>> to it.
>
> document.formname is okay with HTML 4.
No, it is not. W3C DOM Level 2 HTML makes it clear that HTML 4(.01)
documents are to be scripted using W3C DOM Level 2 HTML. In that sense,
Netscape's document.formname "is HTML 3.2 and before", as it predates HTML
4. Of course, you are confusing markup language and DOM API here.
> You may use the W3C Markup Validation Service to check if an element
> should have an ID.
That is beside the point. All HTML elements can have an ID; `id' is one of
the general attributes. The W3C Markup Validation Service does not check
ECMAScript-based source code for validity or plausibility.
>> I'm pretty certain that using document.getElementById("id") is better
>> than using document.elementname, but at the moment I'm having trouble
>> pointing to any sort of authoritative reference for this.
>
> I recall MSIE used to pollute the global namespace with elements' names
> or IDs, that is, we could get a reference to an element using
> document.elementname or document.elementID. See
> <http://webbugtrack.blogspot.com.br/2007/09/bug-162-global-namespace-
pollution-in.html>
>
> The W3C standards compliant browsers use document.getElementById("ID")
> which is DOM level 1 (1998).
DOM Level 1 has been obsoleted by DOM Level 2 more than a decade ago.
> Interestingly, Firefox still allows references in the old way
> (document.elementID or formName.elementName) when a page is rendered in
> "quirks mode".
If you had read my posting before replying you would know why.
>> [1] It was document.all.formname which was breaking, a very senior coder
>> (but not actually a web / js coder) "fixed" it by changing
>> document.all.formname to document.formname, but I think the fix is almost
>> as prone to future breakage as the original code was, and would prefer to
>> see document.getElementById("formid") used instead, with approriate IDs
>> allocated to forms.
>
> Yes, this sort of "fix" is error prone.
So much, so good.
> But a form's ID is not required in HTML 4 - only XHTML pages should
> require IDs:
Utter nonsense.
> <http://www.w3.org/TR/xhtml1/diffs.html>
Nothing there supports your argument. What is stated there instead is that
the `id' attribute is of *type* ID in XHTML 1.0, as opposed to HTML 4.01
where it is of type NAME, because XML requires that there be only one
attribute with type ID on an element type. As a result, anchors must adapt.
But of course XHTML documents may have `name' attributes (of type CDATA) as
well.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
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