RESOLVED CONFIGURATION CHANGED 15152
(Needs test) getElementsByTagName to find sub-elements with the same id
https://bugs.webkit.org/show_bug.cgi?id=15152
Summary (Needs test) getElementsByTagName to find sub-elements with the same id
David Gasaway
Reported 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.
Attachments
Testcase (628 bytes, text/html)
2007-09-06 09:48 PDT, David Gasaway
no flags
David Gasaway
Comment 1 2007-09-06 09:48:05 PDT
Created attachment 16209 [details] Testcase
David Gasaway
Comment 2 2007-09-06 09:51:45 PDT
Forgot to mention: works in Firefox, Opera, IE7.
David Kilzer (:ddkilzer)
Comment 3 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).
David Kilzer (:ddkilzer)
Comment 4 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.
David Gasaway
Comment 5 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. :)
Alexey Proskuryakov
Comment 6 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.
David Gasaway
Comment 7 2010-10-29 15:41:57 PDT
Yes, seems to be fixed in both Safari 5 and Chrome 7 on Windows.
Ahmad Saleem
Comment 8 2022-08-12 04:23:56 PDT
I am not able to reproduce this issue and Comment 06 do mention it being fixed long time back, I think it was changed to upload "Regression Testcases" but we do have coverage for them in WPT now: https://wpt.fyi/results/dom/nodes?label=master&label=experimental&aligned&view=subtest&q=getElementsByTagName Do we need to upload anymore tests? BY THE WAY - we do fail some test around "getElementsByTagName" from WPT? I can create separate bug for them (if it already does not exist). Appreciate if someone can update this accordingly or suggest whether I should create a separate bug for WPT failures. Thanks!
Ryosuke Niwa
Comment 9 2022-08-12 10:02:11 PDT
This is working now, and I'm pretty sure we have a test for this.
Note You need to log in before you can comment on or make changes to this bug.