-
Notifications
You must be signed in to change notification settings - Fork 711
[css-values-5] Disallow mix/random/tree-counting functions in some contexts #10982
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
Some types of mix functions are reasonable to allow anywhere, they just represent the interpolation between two values and that's fine. We could also define something reasonable for |
Allowing them anywhere would require making some arguments ( |
I was thinking they should be allowed in container queries, evaluating against the container element, but then the size query container may fall back to the viewport which is not an element. |
@tabatkins @emilio @nt1m Any opinions on whether tree-counting functions like sibling-index() should be valid parse time in:
And if such functions are valid, what should they evaluate to. |
Tree-counting functions such as sibling-index() do not have a useful interpretation in contexts where there are no elements involved. For instance in @media queries and @font-face descriptors. This is currently not per any specification, but there is an open issue for it: w3c/csswg-drafts#10982 We still allow sibling-index() in @page properties with this CL. Bug: 40282719 Change-Id: I10b939d1981e9eb3347f18a7ef292cdd425b3cbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6352179 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1432625}
Tree-counting functions such as sibling-index() do not have a useful interpretation in contexts where there are no elements involved. For instance in @media queries and @font-face descriptors. This is currently not per any specification, but there is an open issue for it: w3c/csswg-drafts#10982 We still allow sibling-index() in @page properties with this CL. Bug: 40282719 Change-Id: I10b939d1981e9eb3347f18a7ef292cdd425b3cbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6352179 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1432625}
Tree-counting functions such as sibling-index() do not have a useful interpretation in contexts where there are no elements involved. For instance in @media queries and @font-face descriptors. This is currently not per any specification, but there is an open issue for it: w3c/csswg-drafts#10982 We still allow sibling-index() in @page properties with this CL. Bug: 40282719 Change-Id: I10b939d1981e9eb3347f18a7ef292cdd425b3cbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6352179 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1432625}
I think it makes sense to disallow them to begin with... Only container queries really have something resembling a sensible behavior IMO, and what should the fallback behavior be is not particularly clear... Disallowing it gives us more leeway to decide on what the right behavior should be once there are concrete use cases for it... |
Yeah, I'm fine with starting with them all disallowed, parse-time invalid. We can turn them on as requested. |
…element contexts, a=testonly Automatic update from web-platform-tests Disallow tree-counting functions in non-element contexts Tree-counting functions such as sibling-index() do not have a useful interpretation in contexts where there are no elements involved. For instance in @media queries and @font-face descriptors. This is currently not per any specification, but there is an open issue for it: w3c/csswg-drafts#10982 We still allow sibling-index() in @page properties with this CL. Bug: 40282719 Change-Id: I10b939d1981e9eb3347f18a7ef292cdd425b3cbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6352179 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1432625} -- wpt-commits: ec3fe6dd156fe077571b3219eae3d7e49f1e9025 wpt-pr: 51353
Based on comments in #10879, any value defined in CSS Values and Units should be valid in any context other than a property value, unless otherwise specified.
mix, random, tree couting functions, need an element, but are not explicitly disallowed in other contexts.
I would say they should be invalid in media queries and any descriptor value, and valid in the prelude of keyframe and
@container
rules. (It seems easier to find use cases in the prelude of keyframe rules.)Perhaps defining the concept of element-dependent (substitution) value could help clarifying this: such value would be invalid in all contexts except those "associated" to an element, or that do not need to resolve its value (feature queries).
var()
,attr()
,toggle()
,<whole-value>
, would be element-dependent subsitution values.I do not know if any of these substitution functions should/can be valid in the HTML
srcset
attribute (to replace<length>
), but invalid in themedia
attribute. I guess none is currently accepted, not even math functions.The text was updated successfully, but these errors were encountered: