Comments (2)
Somewhat related... Sometimes specs:
- disallow whitespace between component values, like
'<'
,<type-name>
, and'>'
- require whitespace, like between two
<complex-selector-unit>
s if the<combinator>
between them is omitted
But it is not explicitly required after using
in using ( <dependency-list> )
. Obviously there would be a function if the whitespace was omitted, so this may not be worth clarifying. (Please tell me if I should open a separate issue.)
An omitted whitespace between two symbols, eg. <foo><bar>
, does not mean that a whitespace in the input is disallowed. My point is that if whitespaces were defined to be disallowed between an expression defining a function's name and (
, a syntax like <function-name>(<declaration-value>#)
for <dashed-function>
would be unambiguous.
Fwiw, I think this would be confusing and error-prone. A simpler solution is to rewrite with using <dependency-block>
.
Also note that disallowing a whitespace before a multiplier or '>'
, or after '<'
, sets a precedent whereas <foo> +
, while a bit confusing, is unambiguous to parse since multipliers are not allowed to appear unquoted in a value definition.
In my humble experience, spec authors often omit whitespace in various cases:
a| b
<a><b>
[a b ]
fn( a b)
They can all be parsed fine. I expect CSS authors to also omit whitespaces. This may be relaxed later, but perhaps they would appreciate some forgiving syntax. I think functions are the only ambiguous case.
from csswg-drafts.
Re: your whitespace comment, there's a bit more, too. Here's the syntax, currently:
<@function> = @function <<function-name>> [ ( <<parameter-list>> ) ]?
[ using ( <<dependency-list>> ) ]?
[ returns <<type>> ]?
{
<<declaration-rule-list>>
}
In addition to the using
detail (using ()
is allowed, using()
is illegal), the main parameters are also separate and optional, so @function --foo ()
is allowed, but @function --foo()
is illegal.
This seems odd; in JS, function foo() {...}
is, I think, the most common syntactic form (even tho function foo () {...}
is allowed in JS, too). I think we should probably at minimum switch to that; possibly we can allow both forms, if useful. This is a novel syntactic form, so even tho it's kinda unprecedented, that might still be acceptable.
@andruud , did you intend to write both of these locations with that whitespace, or was it unintended?
from csswg-drafts.
Related Issues (20)
- [css-mixins] `<combinator>` is already defined in Selectors HOT 1
- [css-mixins] Disallow whitespace when matching `'<' transform-list '>'` HOT 2
- [css-mixins] Should `result` be mandatory in `@function`? HOT 1
- [css-filter-effects-1] Missing definition of a reference for percentage values if filterUnits="userSpaceOnUse" HOT 3
- [css-fonts] Font fallback for (Unicode) decomposable characters is browser-dependent HOT 1
- [selectors] Parameterized selectors HOT 16
- [css-view-transitions-2] (feature) access view-transition snapshot as an image/ImageData HOT 6
- [scroll-animations] Allow smooth animation from lvh to svh
- [web-animations] how to make animate() method work with CSSKeyframesRule object? HOT 4
- [css-color-5]: Relative Colors doesn’t work with `calc(l + 10%)` HOT 1
- [css-color-5]: light-dark() doesn’t work with Relative Colors HOT 2
- Two "variants" of `color-mix()` ?? HOT 3
- [css-animations-2][web-animations-2] (proposal) Add pointer driven animations
- [css-values-5] Should `interpolate-size` be a new value to animation/transition-behavior? HOT 5
- CSS Color; light-dark() should be applicable on more properties. HOT 6
- [css-color-4] Evaluate static gamut mapping algorithms for oklab/oklch spaces HOT 3
- [css-easing-2] Linear easing function requires at least two points?
- [scroll-animations-1] Consider adding a timeline range that takes ink overflow into account
- [scroll-animations-1][css-animations-1] A non-animated "Is in viewport"
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.