Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19330

Re: Accessing image property in IE when there's a period in the html ID?

Message-ID <19825448.DougqSLUUr@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-04-18 12:39 +0200
Subject Re: Accessing image property in IE when there's a period in the html ID?
Newsgroups comp.lang.javascript
References <kkn90j$nuv$1@news.albasani.net> <kknb7u$rnl$1@news.albasani.net> <1411375.u70iIU05oh@PointedEars.de> <kkogbh$muh$1@dont-email.me>

Show all headers | View raw


Jukka K. Korpela wrote:

> 2013-04-18 12:06, Thomas 'PointedEars' Lahn wrote:
>> However, using an ID (“id” attribute value of “img” elements) instead of
>> a name (“name” attribute value of “img” elements) is not
                                                    ^
>> backwards-compatible to DOM Level 0.
> 
> […] focus on warning against good coding
> practices on the grounds of something that might happen in early
> releases of Internet Explorer 3 or Netscape Navigator 2.

The phrase “as index” (to document.images) in the marked spot got lost on 
rewording, as the resource referred by the first URL further down (trimmed 
here by the author of the precursor) shows.

document.getElementById() was not available before Internet Explorer 5.5 
(2000-07), Netscape Navigator 6.0 (2000-11), Mozilla 0.6 (2000-12), and 
Phoenix/Firefox 0.1 (2002-09-23), to name a few.

DOM Level 1, which introduced document.getElementById(), became a W3C 
Recommendation on 1998-10-01 already, though. [1]  The term “DOM Level 0”, 
defined in hindsight in W3C DOM Level 2 HTML (that obsolotes DOM HTML 
Level 1), describes features that were *introduced* with IE 3 and NN 2, and 
by the time of NN 3 were the only *common* features of DOM implementations 
until the first two interoperable implementations of W3C DOM Level 1. [2]

Research as to where and when document.images[…] first supported IDs is 
pending, but it was probably not before IE 5.5 and NN 6.0 because that is a 
W3C DOM feature (AISB).  See also 
<http://stackoverflow.com/a/9160009/855543>.

As for “good coding practices”, it is _not_ a “good coding practice”, let 
alone best current practice, to use a method call to search a larger 
HTMLCollection when you can search a smaller one without a method call, more 
precisely, and in a less error-prone and more compatible way.

<http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/>
<http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/glossary.html>

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing image property in IE when there's a period in the html ID? Tuxedo <tuxedo@mailinator.com> - 2013-04-18 00:50 +0200
  Re: Accessing image property in IE when there's a period in the html ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-18 01:29 +0200
    Re: Accessing image property in IE when there's a period in the html ID? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-04-18 07:53 +0300
      Re: Accessing image property in IE when there's a period in the html ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-18 10:07 +0200
    Re: Accessing image property in IE when there's a period in the html ID? Tuxedo <tuxedo@mailinator.com> - 2013-04-18 08:39 +0200
    Re: Accessing image property in IE when there's a period in the html ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-18 11:06 +0200
      Re: Accessing image property in IE when there's a period in the html ID? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-04-18 13:05 +0300
        Re: Accessing image property in IE when there's a period in the html ID? Andrew Poulos <ap_prog@hotmail.com> - 2013-04-18 20:21 +1000
        Re: Accessing image property in IE when there's a period in the html ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-18 12:39 +0200
          Re: Accessing image property in IE when there's a period in the html ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-18 16:38 +0200
            Re: Accessing image property in IE when there's a period in the html ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-19 01:25 +0200
              Re: Accessing image property in IE when there's a period in the html ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-19 19:40 +0200
                Re: Accessing image property in IE when there's a period in the html ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-19 19:52 +0200
        Re: Accessing image property in IE when there's a period in the html ID? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-04-18 13:56 +0300
          Re: Accessing image property in IE when there's a period in the html ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-18 13:19 +0200

csiph-web