Comments (3)
Unregistered custom properties just tokenize, except for a few things like var()
and env()
. So:
- If
first-valid()
is a normal function, it's accepted, as a token. - Otherwise I guess it's invalid.
I don't see any reason to treat it specially, since unregistered custom properties accept almost everything?
I don't think it's likely that people will want --foo: first-supported(var(b), var(--b))
to behave as --foo: var(--b)
because --foo: var(b)
is invalid.
I think it's more likely that people will want to defer the resolution of first-supported
, e.g.
:root {
--color: first-supported(color(brand-new-color-space, ...), cyan);
}
.foo { color: var(--color) }
#bar something { color: var(--color) }
from csswg-drafts.
Unregistered custom properties just tokenize, except for a few things like
var()
andenv()
.
I have not considered this option. So --custom: first-valid(not, whole) value
is valid but not --custom: first-valid(1) var(--empty, var(invalid))
, and a CSS parser should therefore not try matching <whole-value>
as a replacement for a custom property value, but only for standard properties?
Even if first-valid(not, whole) value
is guaranteed to be invalid in any declaration value, it would probably not be usefull to make it invalid at parse time also for a custom property value. It just seems more consistent though.
from csswg-drafts.
Unregistered custom properties do not grammar-check at all besides the basic validity of substitution functions in their value. They shouldn't do anything special for first-valid()
either; that's just part of every property's grammar, and thus included in the "no parsing beyond tokenization" aspect.
Remember that one of the reasons we don't grammar-check custom properties is because they can be used to pass around information for non-CSS purposes; we do only the absolute bare minimum of checking (CSS-wide keywords, and other substitution functions) so people can avoid having to think abuot it as much as possible.
That said, I think it's reasonable to clarify this in the spec.
from csswg-drafts.
Related Issues (20)
- [css-scoping] Add abilty to select slot fallback content
- [css-color-5] Edge cases for color-mix() percentage serialization questions HOT 1
- [css-view-transitions-2] Elements with content-visibility in new Document HOT 3
- [css-scroll-snap-2] How should competing scroll-start-targets be resolved? HOT 2
- [css-ui] Should `::picker(select)` match `:popover-open`? HOT 12
- [css-anchor-position-1] have a better example of using math functions with the anchor() function
- [css-variables][css-pseudo] Question about setting variable values in pseudo classes HOT 3
- [css-flex] Nobody follows the spec regarding intrinsic size of flex container HOT 5
- [css-view-transition-2] Should non-default `view-transition-group` act like `contain`? HOT 6
- [css-flexbox-1] Change flex shorthand of flex:1 back to setting a flex-basis of 0%. HOT 1
- [css-conditional] @container scroll-state(snapped) and snapchanged vs snapchanging
- [css-text] Performance risks of text-wrap:pretty HOT 1
- [css-shadow-parts] are rules for which pseudo-classes and pseudo-elements work after ::part() parse-time or match-time? HOT 1
- [css-shadow-parts] need definition of which pseudo-classes can follow :part() that is sufficient to produce interoperability HOT 1
- [css-shadow-parts][css-nesting] is & allowed after ::part()
- [css-view-transitions-2] Use `@starting-style` to customize initial/final states of content pseudos HOT 4
- [css-values-4][css-conditional] Define `<atomic-condition>` that other specs reference
- [css-text] Replacement for `text-align: <string>` and solution for numeric column alignment
- [css-variables] Typo in css-variables-1/Overview.bs
- [css-pseudo] more clearly define which pseudo-elements are tree-abiding or part-like
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csswg-drafts.