[csswg-drafts] [css-cascade-6] Specificity of Implicitly-Added `:scope` in Scoped Rules (#10196)

dshin-moz has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-cascade-6] Specificity of Implicitly-Added `:scope` in Scoped Rules ==
Current [WPT test](https://github.com/web-platform-tests/wpt/blob/master/css/css-cascade/scope-specificity.html) for scoped styles' specificity seems to assume that an unscoped rule has the same specificity as the identically written out scoped rule.
However, the [spec's example](https://drafts.csswg.org/css-cascade-6/#example-66991251) seems to imply that `:scope <descendant-combinator` is implicitly added, and that `:scope`'s specificity is equal to that of other pseudo-classes (i.e. class-like +1).

WebKit and Blink is shipping the [behaviour matching the WPT](https://wpt.fyi/results/css/css-cascade/scope-specificity.html?label=experimental&label=master&aligned).

This leads to behaviours where functionally-identical selectors with explicitly-added `:scope` selector wins despite the ordering. In the example below, WebKit and Chrome both show `.foo` being purple:

```
<!doctype html>
<style>
.foo { color: green }
@scope (:root) {
  :scope .foo { color: purple }
  .foo { color: blue }
}
</style>
<div class="foo">Color?</div>
```

cc: @emilio, @mdubet, @andruud 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10196 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 10 April 2024 19:01:34 UTC