Open
Bug 1882379
Opened 6 months ago
Updated 6 months ago
Generate warning for useless @scope selectors
Categories
(Core :: CSS Parsing and Computation, enhancement)
Core
CSS Parsing and Computation
Tracking
()
NEW
People
(Reporter: dshin, Unassigned)
References
(Blocks 1 open bug)
Details
@scope 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:
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
so it is useless.
Reporter | ||
Updated•6 months ago
|
Severity: -- → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•