Implement supports() syntax for @import rules
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox114 | --- | fixed |
People
(Reporter: sebo, Assigned: canadahonk)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-needed)
Attachments
(1 file, 4 external files)
|
199 bytes,
text/html
|
Details |
Updated•8 years ago
|
Updated•4 years ago
|
| Assignee | ||
Comment 1•3 years ago
|
||
Implemented supports conditions using supports() in @import rules as per
CSS Cascading and Inheritance Level 4.
Spec: https://drafts.csswg.org/css-cascade-4/#conditional-import
WPT tests: https://wpt.fyi/results/css/css-cascade/import-conditions.html
WIP. Todo:
- Format
- Test functionality
- Update WPT expectations
- Potentially add more WPT tests for supports()?
Updated•3 years ago
|
Comment 2•3 years ago
|
||
You can use this as:
input.try_parse(SupportsCondition::parse_for_import).ok()
Or so.
Comment 3•3 years ago
|
||
The #target in the data URI is the url hash, not a selector.
Depends on D172668
Updated•3 years ago
|
Comment 6•3 years ago
|
||
| bugherder | ||
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 8•3 years ago
|
||
@emilio could you have a poke at this crash case, still can't trace locally on my machine. Happens specifically when using a not in an @import supports() and then accessing the CSS rule in JS. Checked some areas, it is not related to serialization/to_css at least.
Comment 9•3 years ago
|
||
Comment 10•3 years ago
|
||
You need something like comment 9. This unwrap is failing.
This is technically a spec issue or mismatch (https://github.com/w3c/csswg-drafts/issues/8608), but I think it's an oversight, and we should assert that CSSImportRule.styleSheet is null when the supports() condition doesn't match and probably remove some of the comments referencing bug 1326509 from dom/webidl/CSSImportRule.webidl.
Comment 11•3 years ago
|
||
We should tweak this code to probably pass around the condition, so that we don't load these speculatively.
https://searchfox.org/mozilla-central/source/layout/style/test/gtest/ImportScannerTest.cpp has some tests where we want to add some. Follow-up is probably ok tho.
Updated•3 years ago
|
Comment 12•3 years ago
|
||
Comment 13•3 years ago
|
||
| bugherder | ||
Updated•3 years ago
|
Comment 14•3 years ago
|
||
Comment 17•3 years ago
|
||
| bugherder | ||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Description
•