Bug 1882379 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

[@scope](https://drafts.csswg.org/css-cascade-6/#scoped-styles) operates define its in-scope regions strictly in terms of ancestor/descendant relationship:

> An element is in scope if:
>   * It is an inclusive descendant of the scoping root, and
>   * It is not an inclusive descendant of a scoping limit.

But it also has `:scope` resolved to the scoping root. This means that it's possible to write some no-effect selectors:

* Scope-end that escapes the ancestor/descendant relationship, like:  `@scope (.scope-start) to (:scope ~ .scope-end /* ... */) { /*...*/ }` == `@scope (.scope-start)`
* Inner rules that will never match, like:

```
@scope (.scope-start) to (.scope-end) {
  /* ... */ :scope ~ * { /* ... */ }
}
```

Note that `&` _may_ resolve to the scoping root, but it's [not always](https://drafts.csswg.org/css-cascade-6/#scope-effects):

> The & selector is defined to represent the **selector representing the scoping root (the <scope-start> selector)**, or else :scope if no selector was specified.

So `& ~ * { /**/ }` isn't guaranteed to be useless.
[@scope](https://drafts.csswg.org/css-cascade-6/#scoped-styles) operates define its in-scope regions strictly in terms of ancestor/descendant relationship:

> An element is in scope if:
>   * It is an inclusive descendant of the scoping root, and
>   * It is not an inclusive descendant of a scoping limit.

But it also has `:scope` resolved to the scoping root. This means that it's possible to write some no-effect selectors:

* Scope-end that escapes the ancestor/descendant relationship, like:  `@scope (.scope-start) to (:scope ~ .scope-end /* ... */) { /*...*/ }` == `@scope (.scope-start)`
* Inner rules that will never match, like:

```
@scope (.scope-start) to (.scope-end) {
  /* ... */ :scope ~ * { /* ... */ }
}
```

Note that `&` _may_ resolve to the scoping root, but it's [not always](https://drafts.csswg.org/css-cascade-6/#scope-effects):

> The & selector is defined to represent the **selector representing the scoping root (the <scope-start> selector)**, or else :scope if no selector was specified.

So `& ~ * { /**/ }` isn't guaranteed to be useless. On the other hand, relative selector style specification `~ * { /* ... */ }` is [anchors on `:scope`](https://drafts.csswg.org/css-cascade-6/#scoped-style-rules) so it is useless.
[@scope](https://drafts.csswg.org/css-cascade-6/#scoped-styles) defines its in-scope regions strictly in terms of ancestor/descendant relationship:

> An element is in scope if:
>   * It is an inclusive descendant of the scoping root, and
>   * It is not an inclusive descendant of a scoping limit.

But it also has `:scope` resolved to the scoping root. This means that it's possible to write some no-effect selectors:

* Scope-end that escapes the ancestor/descendant relationship, like:  `@scope (.scope-start) to (:scope ~ .scope-end /* ... */) { /*...*/ }` == `@scope (.scope-start)`
* Inner rules that will never match, like:

```
@scope (.scope-start) to (.scope-end) {
  /* ... */ :scope ~ * { /* ... */ }
}
```

Note that `&` _may_ resolve to the scoping root, but it's [not always](https://drafts.csswg.org/css-cascade-6/#scope-effects):

> The & selector is defined to represent the **selector representing the scoping root (the <scope-start> selector)**, or else :scope if no selector was specified.

So `& ~ * { /**/ }` isn't guaranteed to be useless. On the other hand, relative selector style specification `~ * { /* ... */ }` is [anchors on `:scope`](https://drafts.csswg.org/css-cascade-6/#scoped-style-rules) so it is useless.
[@scope](https://drafts.csswg.org/css-cascade-6/#scoped-styles) defines its in-scope regions strictly in terms of ancestor/descendant relationship:

> An element is in scope if:
>   * It is an inclusive descendant of the scoping root, and
>   * It is not an inclusive descendant of a scoping limit.

But it also has `:scope` resolved to the scoping root. This means that it's possible to write some no-effect selectors:

* Scope-end that escapes the ancestor/descendant relationship, like:  `@scope (.scope-start) to (:scope ~ .scope-end /* ... */) { /*...*/ }` == `@scope (.scope-start)`
* Inner rules that will never match, like:

```
@scope (.scope-start) to (.scope-end) {
  /* ... */ :scope ~ * { /* ... */ }
}
```

Note that `&` _may_ resolve to the scoping root, but it's [not always](https://drafts.csswg.org/css-cascade-6/#scope-effects):

> The & selector is defined to represent the **selector representing the scoping root (the <scope-start> selector)**, or else :scope if no selector was specified.

So `& ~ * { /**/ }` isn't guaranteed to be useless. On the other hand, relative selector style specification `~ * { /* ... */ }` is [anchored on `:scope`](https://drafts.csswg.org/css-cascade-6/#scoped-style-rules) so it is useless.

Back to Bug 1882379 Comment 0