RESOLVED DUPLICATE of bug 283222 283220
Poor performance of selector div:has(img) button
https://bugs.webkit.org/show_bug.cgi?id=283220
Summary Poor performance of selector div:has(img) button
Jeff Johnson
Reported 2024-11-15 18:40:41 PST
Steps to reproduce: 1. Open https://sdpc.a4l.org/search_national.php 2. Open the web inspector 3. document.querySelectorAll('div:has(img) button') Expected results: The node list is returned immediately. Actual results: The node list takes about 3 seconds to return. Notes: I can reproduce this bug in Safari 18.1 and Safari Technology Preview 207. It does not occur in Google Chrome or Firefox. The returned node list contains 4292 items. document.querySelectorAll('div button') returns immediately. document.querySelectorAll('div:has(img)') also returns immediately.
Attachments
Jeff Johnson
Comment 1 2024-11-15 18:47:42 PST
I should say, this bug is not limited to querySelectorAll. It also affects CSS style sheets. I've changed the title and the component of this bug to reflect that.
Karl Dubost
Comment 2 2024-11-17 18:34:52 PST
Using: var startTime = performance.now(); document.querySelectorAll('div:has(img) button'); var endTime = performance.now(); console.log(`${endTime - startTime} milliseconds`) Safari: 2258 ms Firefox: 1 ms Chrome: 17 ms Safari Technology Preview 207 20621.1.4.3 Firefox Nightly 134.0a1 13424.11.7 Google Chrome Canary 133.0.6843.0 6843.0
Radar WebKit Bug Importer
Comment 3 2024-11-19 15:37:37 PST
Antti Koivisto
Comment 4 2024-11-21 08:41:55 PST
*** This bug has been marked as a duplicate of bug 283222 ***
Note You need to log in before you can comment on or make changes to this bug.