-
Notifications
You must be signed in to change notification settings - Fork 719
[css-cascade] revert-layer
keyword in style attribute
#6743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 |
I'm happy with that approach. Agenda+ for discussion/resolution. |
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
The full IRC log of that discussion |
I think technically all that's needed here is a note, but we should have a note. |
The behavior is recently resolved by CSSWG: w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I3ba69a555fa68b1efb1c40fd9a5362387fd4d541
The behavior is recently resolved by CSSWG: w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I3ba69a555fa68b1efb1c40fd9a5362387fd4d541 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271505 Auto-Submit: Xiaocheng HuReviewed-by: Anders Hartvoll Ruud Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#940370}
The behavior is recently resolved by CSSWG: w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I3ba69a555fa68b1efb1c40fd9a5362387fd4d541 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271505 Auto-Submit: Xiaocheng HuReviewed-by: Anders Hartvoll Ruud Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#940370}
The behavior is recently resolved by CSSWG: w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I3ba69a555fa68b1efb1c40fd9a5362387fd4d541 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271505 Auto-Submit: Xiaocheng HuReviewed-by: Anders Hartvoll Ruud Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#940370}
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? |
… the style attribute, a=testonly Automatic update from web-platform-tests [@layer] Add a WPT for 'revert-layer' in the style attribute The behavior is recently resolved by CSSWG: w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I3ba69a555fa68b1efb1c40fd9a5362387fd4d541 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271505 Auto-Submit: Xiaocheng HuReviewed-by: Anders Hartvoll Ruud Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#940370} -- wpt-commits: 8154494727c8990112979fbf77fda4bee98f4bae wpt-pr: 31571
@xiaochengh let us know if the edits in a64a842 satisfy the question here. |
… the style attribute, a=testonly Automatic update from web-platform-tests [@layer] Add a WPT for 'revert-layer' in the style attribute The behavior is recently resolved by CSSWG: w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I3ba69a555fa68b1efb1c40fd9a5362387fd4d541 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271505 Auto-Submit: Xiaocheng HuReviewed-by: Anders Hartvoll Ruud Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#940370} -- wpt-commits: 8154494727c8990112979fbf77fda4bee98f4bae wpt-pr: 31571
Not a strong opinion, but I would like to see if an alternative idea may work. a64a842 says if we have My original mental model is that ... so that the specified value is calculated as if no rules were specified in the current cascade layer and any succeeding layer in the layer ordering for this property on this element. The only problem is that the Anyway, this is not an opposition. I have some concerns with a64a842 and I'll be happier if my original mental model works, but I can still accept a64a842 as the final spec. |
@xiaochengh to diagram, the current spec works like:
And you're proposing a much more limited scope, where only the current layer is reverted, separately for normal and important versions of a layer? Something like:
To some extent, both of these will be new and possibly unexpected for authors, who have generally not thought about importance-reversal before now. Authors are likely to try reverting styles in a normal layer by using I don't think it makes sense to revert the normal and important versions of a layer without touching the layers in-between? If authors want to override a normal rule with I'd be interested in @jensimmons perspective on this as well. |
No. My mental model works like:
That's what I meant by " In this example, we ignore |
@xiaochengh aha, I agree that would likely make sense from an author perspective - and is a more direct interpretation of the resolution. Thoughts, @fantasai? |
The behavior is recently resolved by CSSWG: w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I3ba69a555fa68b1efb1c40fd9a5362387fd4d541 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3271505 Auto-Submit: Xiaocheng HuReviewed-by: Anders Hartvoll Ruud Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#940370}
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
The full IRC log of that discussion |
... following the recent resolution w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I18199921007b7d8fbdb2ab8bd6c8576a9f1125a5
... following the recent resolution w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I18199921007b7d8fbdb2ab8bd6c8576a9f1125a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3312123 Reviewed-by: Anders Hartvoll RuudCommit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#947555}
... following the recent resolution w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I18199921007b7d8fbdb2ab8bd6c8576a9f1125a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3312123 Reviewed-by: Anders Hartvoll RuudCommit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#947555}
... following the recent resolution w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I18199921007b7d8fbdb2ab8bd6c8576a9f1125a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3312123 Reviewed-by: Anders Hartvoll RuudCommit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#947555}
The spec already reflected this resolution, so closing. ^_^ |
…evert-layer' in the style attr, a=testonly Automatic update from web-platform-tests [@layer] Add a WPT test for important 'revert-layer' in the style attr ... following the recent resolution w3c/csswg-drafts#6743 (comment) Bug: 1095765 Change-Id: I18199921007b7d8fbdb2ab8bd6c8576a9f1125a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3312123 Reviewed-by: Anders Hartvoll RuudCommit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#947555} -- wpt-commits: d3f1f639432dc373bdc8cb1cafddeef3c26d892a wpt-pr: 31824
What should we do when
revert-layer
is used in the style attribute?For example,. I can think of two options:
- Treat style attribute as if in its own layer (though importance is handled differently), so we revert
- Style attribute is not in any layer, so
color
to the highest author layercolor: revert-layer
is an invalid declaration, andcolor: red
wins the cascadeI 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.@mirisuzanne
The text was updated successfully, but these errors were encountered: