-
Notifications
You must be signed in to change notification settings - Fork 693
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
[css-conditional-5] Feature detection for descriptors #2463
Comments
I agree that being able to detect descriptor support is valuable. I would have thought it belongs in CSS Conditional. |
Yeah, it's Conditional - this is precisely why we took care to include arbitrary functional terms in the @supports grammar which resolve to unknown, so we can add more types of support-testing in the future. (Need to also be able to test for types, like if "1foo" is a |
Something like |
@tabatkins Did you mean to write: @supports descriptor(@font-face, font-display: block) { ... } |
Maybe. We have a clear syntax extension path if we want to, but why do we need to test if |
Yes, I did mean that.
Yeah, one could do that, but given that UAs will have explicit parsers for each value type for Typed OM purposes, we'll be able to expose that directly, if it makes one's intent clearer. |
Sure, but when you want to use a value, you're going to use it somewhere. And it is possible that the UA supports that value without supporting it where you planned to use it. For instance, a newer version of a property may accept % and length while the old one only took %. The browser you're in does not yet support the length version yet, but does support the new fancy length unit you want to use in places where it does support length. In that sense, while |
The |
It'd be nice to have this for @supports descriptor(@property, syntax: "<color>") { ... } |
Yeah, |
Especially in [css-properties-values-api] currently implemented by Chrome, |
Is it possible to do a CSS |
I like the I also wonder if there are any traps regarding some descriptors depending on other descriptors. For example, the following is hard to evaluate if we don't also know the
For syntax |
It's syntactically valid in either case, we would just invalidate the rule as a whole if |
Of course, but my point was that checking for parsing validity alone isn't enough to do what people (/ @yisibl) want for For example |
Hm, that's true. Validity of Editted to add: wait no that's not the case, it does check for known non-terminals. The problem is just that we don't support the |
Just want to mention my syntax suggestion from #5929 here: @supports (@page { size: 10cm; }) {
...
} That would work like the existing parsing checks for properties and selectors, so no new logic here. It only requires to extend the syntax of Sebastian |
We also need a way to query support for
Through the same general syntax. I like @SebastianZ's suggestion above and it does lend itself nicely to detection of Also there have been proposals about at-rules that would be nested inside other at-rules or regular CSS rules. We should take that into account when designing this syntax, so we don't need to add more ad hoc syntax in the future to cover these use cases. |
@tabatkins Should this issue have a “Needs Edits” label? I looked into the specs and didn't find a mention of the Context: https://codepen.io/propjockey/pen/OJdJmya?editors=1100 — right now developers have to test for “features that co-exist” with the at-rule implementations in order to test the at-rule support. It would be awesome to have a better way to do this, and I think the sooner it would be possible to do so — the better, as more potential at-rules would get covered by this. |
It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2
It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2
It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5972643 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1376258}
It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5972643 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1376258}
This is much needed. Use case: We can use if ('ascentOverride' in new FontFace(1,1)) {...} |
It is now supported by all major browsers. See https://web.dev/articles/css-size-adjust |
…, a=testonly Automatic update from web-platform-tests Implement at-rule for use with @supports. It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5972643 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1376258} -- wpt-commits: 30d1140df3e85670983adf8de61ed07fdca9cdbb wpt-pr: 48907
Safari 16 is still quite big, as it’s the last version to support iPhone 8 (last iPhone model before Face ID; excluding iPhone SE 3) and iPhone X. |
@yisibl My point exactly. I only want a |
…, a=testonly Automatic update from web-platform-tests Implement at-rule for use with @supports. It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5972643 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1376258} -- wpt-commits: 30d1140df3e85670983adf8de61ed07fdca9cdbb wpt-pr: 48907
…, a=testonly Automatic update from web-platform-tests Implement at-rule for use with @supports. It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5972643 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1376258} -- wpt-commits: 30d1140df3e85670983adf8de61ed07fdca9cdbb wpt-pr: 48907
Currently,
@supports
andCSS.supports
only supportproperty: value
pairs. The only way for web developers to detect support for a certain descriptor in an at-rule is to use JavaScript. For example:(from https://bugzilla.mozilla.org/show_bug.cgi?id=1296373#c6)
It would be good if CSS can test whether a user agent supports a
descriptor: value
pair.See also a related issue in Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=600137
Tagged as "unknown/future spec" for now, because I'm not sure if we should extend
@supports
(which is incss-conditional
), or develop a new mechanism for it.The text was updated successfully, but these errors were encountered: