You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-cascade] revert-layer keyword in style attribute #6743
What should we do when revert-layer is used in the style attribute?
For example, <div style="color: red; color: revert-layer">. I can think of two options:
Treat style attribute as if in its own layer (though importance is handled differently), so we revert color to the highest author layer
Style attribute is not in any layer, so color: revert-layer is an invalid declaration, and color: red wins the cascade
I prefer option 1 because it is simpler to implement (no parse-time special-casing). And other than an obscure way to cancel other declarations in the style attribute, I'm not sure if there is any real use case of putting revert-layer in the style attribute, so I prefer keeping things simple.
Elika and I agree that since style attributes are now in their own origin, they (implicitly) sit in their own unlayered layer, unrelated to any author-level layers. (And with no way to declare any additional layers.) So yeah, it would just roll back to the previous origin, the author layer, which is the suggested Option 1 behavior.
The CSS Working Group just discussed [css-cascade] revert-layer keyword in style attribute, and agreed to the following:
RESOLVED: it would revert the style attribute and nothing else
The full IRC log of that discussion
<dael_> Topic: [css-cascade] revert-layer keyword in style attribute
<dael_> github: https://github.com//issues/6743
<dael_> miriam: Similar. Question is what does it do in context where layer is not clear. In this case in style attribute. What happens?
<dael_> fantasai: Had recently switched style attribute to be its own origin. Natural fallout is it would revert the style attribute and nothing else.
<dael_> Rossen_: Soudns reasonable
<dael_> chrishtr: Is that option 1?
<dael_> TabAtkins: Yes
<dael_> Rossen_: Other ideas or objections?
<dael_> RESOLVED: it would revert the style attribute and nothing else
<TabAtkins> basically same as doing 'revert-layer' in unlayered author styles
I don't think we technically made element-attached styles into an origin, though maybe the implications are similar (or we should move them into an origin). Currently they have their own stage of the cascade: https://drafts.csswg.org/css-cascade-5/#style-attr
Maybe a note is still enough? Something similar to the note regarding origins?
Yes. Thinking about this more, I'm not sure what's more intuitive as a model, but certainly if you have written some styles into a layer and are expecting your !important rules to override your normal rules, but we remove only the !important rules, things are likely to break. So I think we have to go with @xiaochengh's model.
The CSS Working Group just discussed revert-layer keyword in style attr, and agreed to the following:
RESOLVED: Accept suggested behavior, where `revert-layer !important` in style attr only reverts the style-attr origins and the animations origin, ignoring other author origins
The full IRC log of that discussion
<TabAtkins> Topic: revert-layer keyword in style attr
<TabAtkins> github: https://github.com//issues/6743#issuecomment-971826541
<TabAtkins> miriam: we talked about this a few weeks ago, and resolved that the revert-layer keyword in a style attr should only revert the style attr.
<TabAtkins> miriam: but that becomes complex and unclear when thinking about how style relates to normal and important layers
<TabAtkins> miriam: we've drawn some diagrams in the thread about different ways this could work
<TabAtkins> miriam: main question is: if you use `revert-layer !important` in a style attr, is that still only revert the style attr, and maybe the animations layer, but no author layers? Or is it also reverting important author layers, taking you down to normal author layers?
<Rossen_> q?
<TabAtkins> miriam: I think we meant the former, but there's some confusion there.
<Rossen_> ack BoCupp
<Zakim> BoCupp, you wanted to say in Florian's example state of the range is changed, and if a range intersects a contained element and its state changes its allowed to invalidate its
<Zakim> ... painting
<TabAtkins> miriam: proposal is that setting `revert-layer !important` in the style attr, it reverts the style-attr layer, the animations layer, and nothing else
<TabAtkins> fantasai: looking at the ascii diagram from Xiaocheng, most revert behaviors cut from the important to the normal origin, and remove everything between those two points
<TabAtkins> fantasai: but because style attr is weird, on top of both normal and important, if we similarly cut thru like that, it'll remove important styles from layers but not the normal styles from those layers
<TabAtkins> fantasai: so i think because it's likely to break expectations of someone writing a layer to remove the important part but not the normal part, i think it's better to do this skipping behavior
<TabAtkins> fantasai: a little concerned about how this plays out in impls, but since Xiaocheng wants it, i think we should go with it
<fantasai> TabAtkins: Looked it over before the meeting, and with you all and Xiaocheng agreeing, I'm happy to go with this
<TabAtkins> Rossen_: objections?
<TabAtkins> RESOLVED: Accept suggested behavior, where `revert-layer !important` in style attr only reverts the style-attr origins and the animations origin, ignoring other author origins
Activity
xiaochengh commentedon Oct 18, 2021
Btw, the resolution should be consistent with VTT STYLE blocks since it has a similar role and the same cascade precedence as the style attribute.
This gives a stronger reason to choose option 1, since banning
revert-layerfrom the VTT STYLE block makes things even more complicated.mirisuzanne commentedon Oct 18, 2021
I'm happy with that approach. Agenda+ for discussion/resolution.
tabatkins commentedon Oct 21, 2021
Elika and I agree that since style attributes are now in their own origin, they (implicitly) sit in their own unlayered layer, unrelated to any author-level layers. (And with no way to declare any additional layers.) So yeah, it would just roll back to the previous origin, the author layer, which is the suggested Option 1 behavior.
css-meeting-bot commentedon Nov 3, 2021
The CSS Working Group just discussed
[css-cascade] revert-layer keyword in style attribute, and agreed to the following:RESOLVED: it would revert the style attribute and nothing elseThe full IRC log of that discussion
<dael_> Topic: [css-cascade] revert-layer keyword in style attribute<dael_> github: https://github.com//issues/6743
<dael_> miriam: Similar. Question is what does it do in context where layer is not clear. In this case in style attribute. What happens?
<dael_> fantasai: Had recently switched style attribute to be its own origin. Natural fallout is it would revert the style attribute and nothing else.
<dael_> Rossen_: Soudns reasonable
<dael_> chrishtr: Is that option 1?
<dael_> TabAtkins: Yes
<dael_> Rossen_: Other ideas or objections?
<dael_> RESOLVED: it would revert the style attribute and nothing else
<TabAtkins> basically same as doing 'revert-layer' in unlayered author styles
fantasai commentedon Nov 4, 2021
I think technically all that's needed here is a note, but we should have a note.
[@layer] Add a WPT for 'revert-layer' in the style attribute
[@layer] Add a WPT for 'revert-layer' in the style attribute
[@layer] Add a WPT for 'revert-layer' in the style attribute
[@layer] Add a WPT for 'revert-layer' in the style attribute
mirisuzanne commentedon Nov 12, 2021
I don't think we technically made element-attached styles into an origin, though maybe the implications are similar (or we should move them into an origin). Currently they have their own stage of the cascade: https://drafts.csswg.org/css-cascade-5/#style-attr
Maybe a note is still enough? Something similar to the note regarding origins?
11 remaining items
fantasai commentedon Nov 22, 2021
Yes. Thinking about this more, I'm not sure what's more intuitive as a model, but certainly if you have written some styles into a layer and are expecting your !important rules to override your normal rules, but we remove only the !important rules, things are likely to break. So I think we have to go with @xiaochengh's model.
[css-cascade-5] Revert-layer in style attr does not revert author lay…
css-meeting-bot commentedon Dec 2, 2021
The CSS Working Group just discussed
revert-layer keyword in style attr, and agreed to the following:RESOLVED: Accept suggested behavior, where `revert-layer !important` in style attr only reverts the style-attr origins and the animations origin, ignoring other author originsThe full IRC log of that discussion
<TabAtkins> Topic: revert-layer keyword in style attr<TabAtkins> github: https://github.com//issues/6743#issuecomment-971826541
<TabAtkins> miriam: we talked about this a few weeks ago, and resolved that the revert-layer keyword in a style attr should only revert the style attr.
<TabAtkins> miriam: but that becomes complex and unclear when thinking about how style relates to normal and important layers
<TabAtkins> miriam: we've drawn some diagrams in the thread about different ways this could work
<TabAtkins> miriam: main question is: if you use `revert-layer !important` in a style attr, is that still only revert the style attr, and maybe the animations layer, but no author layers? Or is it also reverting important author layers, taking you down to normal author layers?
<Rossen_> q?
<TabAtkins> miriam: I think we meant the former, but there's some confusion there.
<Rossen_> ack BoCupp
<Zakim> BoCupp, you wanted to say in Florian's example state of the range is changed, and if a range intersects a contained element and its state changes its allowed to invalidate its
<Zakim> ... painting
<TabAtkins> miriam: proposal is that setting `revert-layer !important` in the style attr, it reverts the style-attr layer, the animations layer, and nothing else
<TabAtkins> fantasai: looking at the ascii diagram from Xiaocheng, most revert behaviors cut from the important to the normal origin, and remove everything between those two points
<TabAtkins> fantasai: but because style attr is weird, on top of both normal and important, if we similarly cut thru like that, it'll remove important styles from layers but not the normal styles from those layers
<TabAtkins> fantasai: so i think because it's likely to break expectations of someone writing a layer to remove the important part but not the normal part, i think it's better to do this skipping behavior
<TabAtkins> fantasai: a little concerned about how this plays out in impls, but since Xiaocheng wants it, i think we should go with it
<fantasai> TabAtkins: Looked it over before the meeting, and with you all and Xiaocheng agreeing, I'm happy to go with this
<TabAtkins> Rossen_: objections?
<TabAtkins> RESOLVED: Accept suggested behavior, where `revert-layer !important` in style attr only reverts the style-attr origins and the animations origin, ignoring other author origins
[@layer] Add a WPT test for important 'revert-layer' in the style attr
[@layer] Add a WPT test for important 'revert-layer' in the style attr
[@layer] Add a WPT test for important 'revert-layer' in the style attr
[@layer] Add a WPT test for important 'revert-layer' in the style attr
tabatkins commentedon Dec 3, 2021
The spec already reflected this resolution, so closing. ^_^
Bug 1743941 [wpt PR 31824] - [@layer] Add a WPT test for important 'r…
Bug 1740382 [wpt PR 31571] - [@layer] Add a WPT for 'revert-layer' in…
Bug 1743941 [wpt PR 31824] - [@layer] Add a WPT test for important 'r…