Feature request: Add support for if() #23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The if function is currently being spec'ed and nearing completion (no open spec issues). It's shipped in Chrome 137. Lezer doesn't handle it correcly currently: it terminates the declaration at the first semicolon despite the open paren:
More broadly speaking, it looks like lezer doesn't correctly handle a semicolon within a block, which doesn't terminate declarations, e.g.,
--thing: [ ;-) ];.Do these square brackets mean something in this? You'll have to point me at the CSS feature that provides that, because I'm not familiar with it.
Mistake on my part, the unmatched right paren was an error. This however should work:
--thing: [ ; ];. Matched parentheses produce a block, within a block semicolons don't terminate the declaration.https://drafts.csswg.org/css-variables/#defining-variables
https://www.w3.org/TR/css-syntax-3/#typedef-declaration-value
I see. Could you take a look to see if the current main branch works better for you?
Parses
ifsuccessfully, thanks! However, it appears something along the line broke parsing of custom functions such as--foo(bar). This is not parsed as a call anymore.What does calling a variable do, and in which contexts is it allowed?
That's a call of a custom function: https://www.w3.org/TR/css-mixins-1/. It's similar to substution of a custom property using
var(), it substitutes in the result of a custom function declared with@function.That's a draft. Is it supported anywhere? It's not even mentioned on MDN at this point.
Yes, it's still experimental right now. It's in Chrome 139: https://chromestatus.com/feature/5179721933651968
I'm not really committed to tracking every experimental CSS feature in this grammar. The language is becoming a bit of a mess, with the large amount of extensions that's being worked on. Attached patch adds support for variable as callees, but I'm going hold off on supporting
@functionsyntax until it's actually standardized.Fully understood, I primarily brought it up because it was working before, if only accidentaly. I appreciate the immediate fix, thank you!
Tested the changes again, works great! Is there a new release planned in the near future that has the changes? :)
Yes, definitely. I've tagged 1.3.0