Summary: Add a CSS-wide keyword that allows reversing a single rule from
the cascade, rather than a whole origin (like revert) or a layer
(revert-layer). This is useful for var() / attr() / if(), though note we
don't implement the later. E.g. you can use something like `width:
attr(width px, revert-rule)`, and the declaration will be ignored unless
you have a width attribute.
Bug: https://bugzil.la/2017307
Spec: https://drafts.csswg.org/css-cascade-5/#revert-rule-keyword (initially
my proposal in #10443
<https://github.com/w3c/csswg-drafts/issues/10443#issuecomment-2627865962>)
Standards Body: CSS WG
Platform coverage: All
Preference: layout.css.revert-rule.enabled
DevTools bug: https://bugzil.la/2020814
Extensions bug: N/A
Use counter: None [0]
Link to standards-position discussion:
https://github.com/mozilla/standards-positions/issues/1358
Other browsers:

   - Blink: About to ship
   
<https://groups.google.com/a/chromium.org/g/blink-dev/c/ieQj5bt-wA8/m/fvHYOwwfBQAJ>
   - WebKit: work in progress <https://github.com/WebKit/WebKit/pull/59390>

web-platform-tests: See the bug, there's a variety. Note that our
implementation suffers from a couple issues, but those are common to the
pre-existing revert keywords and haven't caused issues in practice:
behavior in @keyframes (bug 1533327 <https://bugzil.la/1533327>), and
behavior with dependent properties (csswg-drafts#9131
<https://github.com/w3c/csswg-drafts/issues/9131>). I don't think these are
blockers given that.

Let me know if there's any concern with proceeding.

Cheers,
 -- Emilio

[0]: While we have somewhat comprehensive machinery to measure CSS values
when parsing, we have two issues that make it non-trivial to measure the
right thing:

   - CSS wide keyword parsing has many entry points due to their nature,
   not all of them carrying the right context (so measuring parsing right
   would be kind of a PITA).
   - Parsing wouldn't be the right thing to measure anyway. Ideally, we'd
   want to count it at cascade time instead (when the value is actually used).
   However we don't have an easy way to do that right now (and I don't think
   it's worth it for a relatively simple feature). I can look into adding that
   separately, filed bug 2020819 <https://bugzil.la/2020819>.

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAFhp-qfW6Zns4%3D%3D0XG-1ftSvr2agdqCc39JpdyKm5PXUi_0UXQ%40mail.gmail.com.

Reply via email to