Bug 233489

Summary: [:has() pseudo-class] Invalidation support for adding and removing elements
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Antti Koivisto <koivisto>
Status: RESOLVED FIXED    
Severity: Normal CC: clopez, ews-watchlist, streltsyn111, webkit-bug-importer, youennf, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/31743
Bug Depends on:    
Bug Blocks: 227702    
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch none

Description Antti Koivisto 2021-11-25 00:30:37 PST
Invalidate on tree mutations
Comment 1 Antti Koivisto 2021-11-25 01:18:05 PST
Created attachment 445124 [details]
Patch
Comment 2 EWS Watchlist 2021-11-25 01:19:06 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 3 Antti Koivisto 2021-11-25 01:43:25 PST
Created attachment 445126 [details]
Patch
Comment 4 Antti Koivisto 2021-11-25 02:06:15 PST
Created attachment 445127 [details]
Patch
Comment 5 Antti Koivisto 2021-11-25 02:06:42 PST
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/31743
Comment 6 Antti Koivisto 2021-11-25 04:01:37 PST
Created attachment 445134 [details]
Patch
Comment 7 EWS 2021-11-25 13:14:26 PST
Committed r286169 (244552@main): <https://commits.webkit.org/244552@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 445134 [details].
Comment 8 Radar WebKit Bug Importer 2021-11-25 13:15:56 PST
<rdar://problem/85754298>
Comment 9 Antti Koivisto 2021-11-27 00:12:34 PST
Reopen for a followup to fix perf regression.
Comment 10 Antti Koivisto 2021-11-27 00:13:39 PST
Created attachment 445214 [details]
Patch
Comment 11 EWS 2021-11-27 01:45:07 PST
Committed r286188 (244570@main): <https://commits.webkit.org/244570@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 445214 [details].
Comment 12 Ilya Streltsyn 2022-01-30 00:25:05 PST
Unfortunately, Lea Verou's testcase with DOM modification in `setTimeout` (https://codepen.io/leaverou/pen/mdBMMrB) still does not work for me in TP 139 on MacBook Air M1/MacOS Monterey 12.2. Both `.has.empty` and `.has.nth` elements stay pink after `setTimeout` fires and modifies their subtree. Only after I either open the Inspector for the first time, modify the CSS in the CodePen panel, or modify `document.styleSheets` after modifying the subtree in the `setTimeout` callback (e.g. add a new valid `cssRule`), these elements become green.

Could you please look into this issue again?
Comment 13 Antti Koivisto 2022-01-30 07:05:52 PST
The test case appears to work fine in trunk, I think STP 139 just doesn't have the fix yet. It might have been fixed in bug 234842.
Comment 14 Antti Koivisto 2022-01-30 07:07:30 PST
Generally it is a good idea to file a new bug for each issue as that ensures they don't get lost. No need to worry about duplicates, we can sort those out.