Bug 123538 - iOS 7 Element.querySelectorAll does not obey element scope with ID
Summary: iOS 7 Element.querySelectorAll does not obey element scope with ID
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Other
: P2 Normal
Assignee: Ryosuke Niwa
URL: http://jsfiddle.net/tfS83/2/
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-10-30 16:25 PDT by Nick Williams
Modified: 2022-08-10 19:38 PDT (History)
8 users (show)

See Also:


Attachments
Patch (10.02 KB, patch)
2015-02-01 17:53 PST, Benjamin Poulain
sam: review+
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-sierra (2.23 MB, application/zip)
2018-04-13 19:12 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews105 for mac-sierra-wk2 (2.59 MB, application/zip)
2018-04-13 19:16 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (8.38 MB, application/zip)
2018-04-13 19:38 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews114 for mac-sierra (2.95 MB, application/zip)
2018-04-13 19:56 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews200 for win-future (12.76 MB, application/zip)
2018-04-13 21:10 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Williams 2013-10-30 16:25:10 PDT
See http://jsfiddle.net/tfS83/2/ for demonstration.

This is new with iOS 7; tested on 7.0 and 7.0.3.  It occurs in Chrome as well as Safari.

When using .querySelectorAll on an element, where the selector is an ID selector, the scope of the element is not taken in to account.  This is contrary to the behavior of iOS 6 and desktop Safari OSX and Windows, Android, etc.
Comment 1 Benjamin Poulain 2015-02-01 17:53:33 PST
Created attachment 245850 [details]
Patch
Comment 2 Benjamin Poulain 2015-02-01 17:56:50 PST
The bug was fixed last year: https://bugs.webkit.org/show_bug.cgi?id=119780

The problem was that documents with duplicates ids were not scoping the search correctly.

This patch is to add a variant of your tests to improve the test coverage.
Comment 3 EWS Watchlist 2018-04-13 19:12:22 PDT
Comment on attachment 245850 [details]
Patch

Attachment 245850 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/7311328

New failing tests:
fast/selectors/querySelector-scoped-by-element.html
Comment 4 EWS Watchlist 2018-04-13 19:12:23 PDT
Created attachment 337943 [details]
Archive of layout-test-results from ews101 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 5 EWS Watchlist 2018-04-13 19:16:32 PDT
Comment on attachment 245850 [details]
Patch

Attachment 245850 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/7311331

New failing tests:
fast/selectors/querySelector-scoped-by-element.html
Comment 6 EWS Watchlist 2018-04-13 19:16:33 PDT
Created attachment 337944 [details]
Archive of layout-test-results from ews105 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 7 EWS Watchlist 2018-04-13 19:38:53 PDT
Comment on attachment 245850 [details]
Patch

Attachment 245850 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/7311417

New failing tests:
fast/selectors/querySelector-scoped-by-element.html
Comment 8 EWS Watchlist 2018-04-13 19:38:54 PDT
Created attachment 337947 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.4
Comment 9 EWS Watchlist 2018-04-13 19:56:37 PDT
Comment on attachment 245850 [details]
Patch

Attachment 245850 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/7311446

New failing tests:
fast/selectors/querySelector-scoped-by-element.html
Comment 10 EWS Watchlist 2018-04-13 19:56:38 PDT
Created attachment 337950 [details]
Archive of layout-test-results from ews114 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 11 EWS Watchlist 2018-04-13 21:10:24 PDT
Comment on attachment 245850 [details]
Patch

Attachment 245850 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/7312201

New failing tests:
fast/selectors/querySelector-scoped-by-element.html
Comment 12 EWS Watchlist 2018-04-13 21:10:35 PDT
Created attachment 337956 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 13 Ahmad Saleem 2022-08-09 08:33:54 PDT
I can only find these two test cases while searching for "querySelectorAll":

https://wpt.fyi/results/dom/nodes?label=master&label=experimental&aligned&view=subtest&q=queryselectorall%20

Do we need to add this test for our coverage or this can be marked as "RESOLVED WONTFIX" at this point since as mentioned in Comment 02 that it was already fixed.

Further, I tested this JSBin across all browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6) and they have same output as below:

ID Div 1
ID Div 2
1 items. Should always be 1.

Class Div 1
Class Div 2
1 items. Should always be 1.
Comment 14 Radar WebKit Bug Importer 2022-08-10 11:02:54 PDT
<rdar://problem/98460467>
Comment 15 Ryosuke Niwa 2022-08-10 11:41:54 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3197
Comment 16 EWS 2022-08-10 19:38:18 PDT
Committed 253315@main (09386b2b402b): <https://commits.webkit.org/253315@main>

Reviewed commits have been landed. Closing PR #3197 and removing active labels.