Bug 229438 - Incorrect specificity with ::slotted
Summary: Incorrect specificity with ::slotted
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Emilio Cobos Álvarez (:emilio)
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2021-08-24 00:23 PDT by Jeroen Zwartepoorte
Modified: 2021-08-28 15:08 PDT (History)
12 users (show)

See Also:


Attachments
Patch (3.08 KB, patch)
2021-08-25 05:11 PDT, Emilio Cobos Álvarez (:emilio)
no flags Details | Formatted Diff | Diff
Patch for landing (7.13 KB, patch)
2021-08-27 05:47 PDT, Emilio Cobos Álvarez (:emilio)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Zwartepoorte 2021-08-24 00:23:42 PDT
https://codepen.io/jpzwarte/pen/oNwNdpN?editors=0110

In Chromium and Firefox, the background is hotpink. In Safari and STP, the background is green.

This is the CSS for the web component:
```css
      :host([foo]) ::slotted(h1) {
        --background: hotpink;
      }
      ::slotted(h1) {
        --background: green;
      }

```
Comment 1 Jeroen Zwartepoorte 2021-08-24 00:25:52 PDT
Workaround is to switch the rules. (hotpink last)
Comment 2 Emilio Cobos Álvarez (:emilio) 2021-08-25 05:11:43 PDT
Created attachment 436385 [details]
Patch
Comment 3 Emilio Cobos Álvarez (:emilio) 2021-08-25 05:12:31 PDT
Gah, Ryosuke, you nerd-sniped me :)

Hoping there's something in WPT for this, if not not sure I'll have the cycles to finish this soon, I'm taking a long weekend off computers :)
Comment 4 Emilio Cobos Álvarez (:emilio) 2021-08-25 08:50:43 PDT
https://github.com/web-platform-tests/wpt/pull/30181 has a test.
Comment 5 Antti Koivisto 2021-08-26 03:45:44 PDT
Maybe import the WPT before landing
Comment 6 Emilio Cobos Álvarez (:emilio) 2021-08-27 05:47:47 PDT
Created attachment 436619 [details]
Patch for landing
Comment 7 EWS 2021-08-27 06:21:36 PDT
Committed r281692 (241042@main): <https://commits.webkit.org/241042@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 436619 [details].
Comment 8 Radar WebKit Bug Importer 2021-08-27 06:22:19 PDT
<rdar://problem/82436071>
Comment 9 Ryosuke Niwa 2021-08-28 15:08:12 PDT
(In reply to Emilio Cobos Álvarez (:emilio) from comment #3)
> Gah, Ryosuke, you nerd-sniped me :)
> 
> Hoping there's something in WPT for this, if not not sure I'll have the
> cycles to finish this soon, I'm taking a long weekend off computers :)

Thanks for the fix!