Bug 283220
| Summary: | Poor performance of selector div:has(img) button | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jeff Johnson <opendarwin> |
| Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | karlcow, koivisto, m_dubet, rreno, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 18 | ||
| Hardware: | Mac (Apple Silicon) | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=283222 | ||
Jeff Johnson
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Jeff Johnson
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
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
<rdar://problem/140235841>
Antti Koivisto
*** This bug has been marked as a duplicate of bug 283222 ***