RESOLVED INVALID 6006
document.getElementById does not behave in the same way as Internet Explorer (Win)
https://bugs.webkit.org/show_bug.cgi?id=6006
Summary document.getElementById does not behave in the same way as Internet Explorer ...
Andrew Wellington
Reported 2005-12-08 03:57:59 PST
In Internet Explorer, document.getElementById() in JavaScript will return form elements (input, select, etc) but not other elements (p, div, etc) with the same name as the id being requested (even if their id is different to the name). This causes some IE-specific JavaScript to fail on Safari as it (rightly according to the specifications) ignores the name when finding the elements requested. An affected product is the eService administration interface from Right Now software (http:// www.rightnow.com/eservice.html) although this interface does claim to only support IE 5.5+. A sample test case will be attached to this bug shortly.
Attachments
Simple demonstration page (530 bytes, text/html)
2005-12-08 03:59 PST, Andrew Wellington
no flags
Andrew Wellington
Comment 1 2005-12-08 03:59:27 PST
Created attachment 5000 [details] Simple demonstration page
Andrew Wellington
Comment 2 2005-12-08 04:09:37 PST
To clarify, when IE walks the tree looking for elements that match the document.getElementById() request, it returns the first element that matches: - id is equal to requested id - element is a form element, and its name matches the requested id
Gavin Kistner
Comment 3 2006-01-17 07:27:02 PST
If any such broken behavior is introduced, it should be only exist in some alternative 'compliant' mode. IE is simply wrong, and steadily losing market share. Suggest you change this bug to invalid. (Some believe that 'de facto' standards present in other browsers are more important than the Standards themselves. I believe the opposite. Matching the spec instead of IE is not a 'bug'. I accept that there are people with both opinions; I do not know which opinion drives Safari's development team.)
Alexey Proskuryakov
Comment 4 2007-11-07 13:03:10 PST
*** Bug 15127 has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 5 2007-11-07 13:04:08 PST
From bug 15127: Opera has this quirk, but is apparently going to remove it from their 9.50 release: "Removed IE-compatibility where Document.getElementById treated name and id attributes the same, which caused problems with jQuery."
Alexey Proskuryakov
Comment 6 2007-11-25 02:49:21 PST
This causes major problems at the site of Beeline, a major mobile provider in Russia. Affected pages are only available to customers.
Anantha Keesara
Comment 7 2007-12-27 17:58:05 PST
"http://markets.themarker.com/tmc/investorGuide.jhtml?layer=investorGuide" (a major Israeli finance portal also has this issue)
Simon Pieters (:zcorpan)
Comment 8 2008-11-26 04:10:14 PST
Is this still an issue? # [13:14] <zcorpan> it seems we have lots of bugs saying that getElementById works with name='' # [13:14] <zcorpan> which we dropped in 9.5 # [13:15] <zcorpan> and no bugs on it not working with name='', afaict # [13:15] <zcorpan> also, i think ie8 doesn't look at name='' (in ie8 mode)
Ryosuke Niwa
Comment 9 2015-10-16 00:58:22 PDT
This is no longer the case with newer versions of IE (e.g. IE9).
Lucas Forschler
Comment 10 2019-02-06 09:02:47 PST
Mass moving XML DOM bugs to the "DOM" Component.
Note You need to log in before you can comment on or make changes to this bug.