Bug 234531

Summary: [:has() pseudo-class] :has() selector does not render on first pass?
Product: WebKit Reporter: Alex Riviere <fimion>
Component: CSSAssignee: Antti Koivisto <koivisto>
Status: RESOLVED FIXED    
Severity: Normal CC: brandon, cchana, koivisto, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac (Apple Silicon)   
OS: macOS 12   
Bug Depends on:    
Bug Blocks: 227702    
Attachments:
Description Flags
A video demonstrating the bug
none
Patch none

Description Alex Riviere 2021-12-20 15:12:13 PST
Created attachment 447653 [details]
A video demonstrating the bug

Hey Y'all,

Just downloaded technology preview 137 to play with the new :has() selector.

made this demo: https://codepen.io/fimion/pen/XWeamBQ

the div surrounding the list should have a 2px solid red border.

The css selector does show up in dev tools, and I can uncheck and then check the border rule, and it will then show up.

I've included a video. Please let me know if you need any more information.
Comment 1 Antti Koivisto 2021-12-21 07:55:14 PST
*** Bug 234559 has been marked as a duplicate of this bug. ***
Comment 2 Antti Koivisto 2021-12-21 07:56:00 PST
Looks like a style sharing bug.
Comment 3 Antti Koivisto 2021-12-22 07:35:41 PST
Created attachment 447804 [details]
Patch
Comment 4 EWS 2021-12-22 10:35:07 PST
Committed r287362 (245504@main): <https://commits.webkit.org/245504@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447804 [details].
Comment 5 Radar WebKit Bug Importer 2021-12-22 10:36:19 PST
<rdar://problem/86817203>
Comment 6 Antti Koivisto 2021-12-26 12:02:44 PST
*** Bug 234642 has been marked as a duplicate of this bug. ***
Comment 7 Antti Koivisto 2022-01-03 06:32:50 PST
*** Bug 234732 has been marked as a duplicate of this bug. ***
Comment 8 Brandon McConnell 2022-01-04 07:56:06 PST
Is there a way to subscribe to this bug and be alerted when the fix is pushed to the live version of Safari TP for testing?
Comment 9 Antti Koivisto 2022-01-04 08:43:01 PST
The fix should be in the next STP. You can follow @WebKit in Twitter to get notified.
Comment 10 cchana 2022-01-09 11:49:33 PST
While I await the next STP, wanted to mention that the following selector worked but aspects of it were ignored.

    label:has(+ input[type="text"])

This would select _all_ labels followed by inputs, rather than only the ones that were followed by text inputs.
Comment 11 Alex Riviere 2022-01-21 07:43:48 PST
Just downloaded STP 138, this bug still exists. It has the same rendering error. Dev tools pick up on the styles correctly, but they are not rendered.

https://codepen.io/fimion/pen/XWeamBQ
Comment 12 Antti Koivisto 2022-01-21 08:05:51 PST
Unfortunately STP138 was based on a rather old revision (r286944) so is missing most if the more recent fixes.