Bug 235840 - [:has() pseudo-class] in combination with interactive pseudo-class can't be called twice
Summary: [:has() pseudo-class] in combination with interactive pseudo-class can't be c...
Status: RESOLVED DUPLICATE of bug 234842
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-28 15:46 PST by Jan Nicklas
Modified: 2022-02-04 22:48 PST (History)
2 users (show)

See Also:


Attachments
Video of the Bug (2.00 MB, image/gif)
2022-01-28 15:46 PST, Jan Nicklas
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Nicklas 2022-01-28 15:46:49 PST
Created attachment 450282 [details]
Video of the Bug

In Safari Technology Preview 139 the :has() selector does not seem to match correctly 
if the argument is an interactive pseudo-class with the universal selector e.g. :has(*:focus) 
and is used twice or more times.

In the following example the form should receive a red border once an input has focus:

<style>
form:has(:focus) {
  background: rgb(255, 246, 167);
}
form:has(:focus):has(input:not(:focus)){
  border: 1px solid red;
}
</style>

  <form>
    <input> 
    <input>  
</form>

I attached a video of the behaviour.
Comment 1 Radar WebKit Bug Importer 2022-02-04 15:47:18 PST
<rdar://problem/88512104>
Comment 2 Antti Koivisto 2022-02-04 22:48:37 PST
Works correctly with trunk (in form:has(:focus):has(input:not(:focus) the latter :has always matches since there is always an unfocused input in this tree). I think this was fixed after STP 139, maybe in bug 234842.

*** This bug has been marked as a duplicate of bug 234842 ***