Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to Implement and Ship: CSS revert keyword.

93 views
Skip to first unread message

Emilio Cobos Álvarez

unread,
Mar 3, 2019, 8:09:26 PM3/3/19
to dev-pl...@lists.mozilla.org
Summary: The CSS `revert` wide-keyword allows authors to ignore all CSS
rules in a given cascade origin[1], while applying rules from other
cascade origins. Trivial example would be:

<style>
div {
display: inline;
}

// somewhere further down...
div {
display: revert; /* Goes back to display: block */
}
</style>

Authors already have the `unset`, `initial` and `inherit` wide-keywords.
Unfortunately, none of them would turn the <div> to its "default" style
(display: block), since that rule is in a user-agent stylesheet that
would be overridden by the declaration. `revert` allows authors to do that.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1215878

Spec: https://drafts.csswg.org/css-cascade/#default

Platforms: all

Estimated or target release: 67

Preference behind which this will be implemented: None, the
css-wide-keyword parsing code is hot, and I don't think there's a way
for this to backfire. But happy to add one if wanted I guess.

Is this feature enabled by default in sandboxed iframes?: Yes

DevTools bug: Devtools autocompletion would work the same way it works
for other wide keywords, so I don't think any special devtools
integration is needed.

Do other browser engines implement this?
Safari has shipped this for quite a while (9.1 on desktop, 9.3 on
mobile, according to MDN[2]). No other engine implements this, however.
Relevant crbug for Blink is [3].

web-platform-tests: There's a very basic WPT test for revert's
functionality. It's not that complex of a (user-facing, at least)
functionality to begin with. It's a bit hard to test much further than
that because you depend on which particular declarations are on the UA
stylesheet (I used the internal property_database.js to test it using a
mochitest).

Any bugfixes or such that I need to do will be added to WPT if possible.

Is this feature restricted to secure contexts? No, like other CSS syntax
features.


-- Emilio

[1]: https://drafts.csswg.org/css-cascade/#cascade-origins
[2]: https://developer.mozilla.org/en-US/docs/Web/CSS/revert
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=579788
0 new messages