[Webkit-unassigned] [Bug 242328] New: Wrong specificity of [:has() pseudo-class]

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 4 19:24:59 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=242328

            Bug ID: 242328
           Summary: Wrong specificity of [:has() pseudo-class]
           Product: WebKit
           Version: Safari 15
          Hardware: Mac (Apple Silicon)
                OS: macOS 12
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: streltsyn111 at gmail.com

The specificity of the selector containing the `:has()` pseudo-class appears to be higher than the specificity of the selector with the same number of classes without it.

Steps to reproduce:

1. Navigate to the https://codesandbox.io/s/peaceful-edison-8kcudt?file=/index.html demo
2. Check the background color of the three cards
3. Open Web Inspector
4. Inspect computed styles of the first card

Expected results:

The first card is light green, the next two cards are light blue.
Web Inspector shows that the rule for the `.card.card--green` selector has overridden the rule for the `.card:has(.title)` selector (as having the same specificity but coming later in the code).

Actual results:

All three cards are light blue.
Web Inspector shows that the rule for the `.card:has(.title)` selector has overridden the rule for the `.card.card--green` selector.


There is a closed bug https://bugs.webkit.org/show_bug.cgi?id=235351 regarding the same topic, so it might be a regression.

Both stable Safari 15.5 and Safari TP 148 display the same behavior. Chrome 103 with the "Experimental Web Platform features" flag enabled displays expected results.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220705/270bc2bf/attachment.htm>


More information about the webkit-unassigned mailing list