Warn for attempts to combine `:host` pseudoclass in ways that never select anything
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox89 | --- | fixed |
People
(Reporter: Gijs, Assigned: emilio)
Details
Attachments
(1 file, 1 obsolete file)
Things like div:host
or :host:hover
can never work, you want :host(div)
and :host(:hover)
. This is somewhat unintuitive as div:before
or window:root
or :root:-moz-lwtheme
and so on all work - it'd be useful if the non-working :host
ones tripped a CSS parsing warning so web/Firefox devs know what they're doing.
Emilio says:
I don't think it should be hard. Somewhere around here we could do something like if reporting_css_errors && has_useless_selector { context.error_reporter.log_css_error(...) } or something
it's a pretty hot code-path I guess, that might be an issue, but since we disable error reporting by default hopefully the extra branch doesn't matter
Assignee | ||
Comment 1•3 years ago
|
||
(which would never match by definition).
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
Maybe I should just remove the rule? It's effect is very subtle :-)
Updated•3 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7f01fb5e6cfa Add a CSS error to the console when using non-featureless :host selectors. r=boris
Comment 4•3 years ago
|
||
bugherder |
Description
•