Bug 15152 - (Needs test) getElementsByTagName to find sub-elements with the same id
Summary: (Needs test) getElementsByTagName to find sub-elements with the same id
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Nobody
Keywords: HasReduction
Depends on:
Reported: 2007-09-06 09:46 PDT by David Gasaway
Modified: 2010-10-29 15:41 PDT (History)
2 users (show)

See Also:

Testcase (628 bytes, text/html)
2007-09-06 09:48 PDT, David Gasaway
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Gasaway 2007-09-06 09:46:59 PDT
getElementsByTagName('*')['...'] doesn't work as expected when used to search for child elements where multiple parent elements have sub-elements of the same id.  Even though the element sought is in the "collection", it isn't returned when trying to access the element by name.  It works when for the first parent element, but not for subsequent parent elements.  I'll attach a test case.

Only tested in Safari 3.0.3 (522.15.5) on Windows XP.
Comment 1 David Gasaway 2007-09-06 09:48:05 PDT
Created attachment 16209 [details]
Comment 2 David Gasaway 2007-09-06 09:51:45 PDT
Forgot to mention: works in Firefox, Opera, IE7.
Comment 3 David Kilzer (:ddkilzer) 2007-09-06 10:20:01 PDT
Confirmed with a local debug build of WebKit r25386 with Safari 3 Public Beta v. 3.0.3 (522.12.1) on Mac OS X 10.4.10 (8R218).

Comment 4 David Kilzer (:ddkilzer) 2007-09-06 10:21:35 PDT
Not a regression as the same issue occurs with Safari 2.0.4 (419.3) with original WebKit on 10.4.10.

Comment 5 David Gasaway 2007-09-06 13:29:32 PDT
FWIW, I get the same results using childNodes -- though accessing that NodeList by id doesn't seem well supported cross-browser.  Heck, now I've found that NodeList doesn't have any standard method for access by id, but it would be nice if worked consistently where it does work. :)
Comment 6 Alexey Proskuryakov 2010-09-22 13:38:53 PDT
This works in Safari 5. Not sure when this was fixed, might make sense to land a regression test.
Comment 7 David Gasaway 2010-10-29 15:41:57 PDT
Yes, seems to be fixed in both Safari 5 and Chrome 7 on Windows.