Skip to content

Commit

Permalink
[css-mixins-1] Do not allow whitespace before parameter list (#11502)
Browse files Browse the repository at this point in the history
This also makes the parameter list required.

A discussion could be had about 'using' as well, but since it looks like
we're going to remove it, that problem will probably disappear on its own.

Co-authored-by: Anders Hartvoll Ruud <[email protected]>
  • Loading branch information
andruud and Anders Hartvoll Ruud authored Jan 14, 2025
1 parent 14ae4f6 commit fe94b66
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions css-mixins-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Defining Custom Functions {#defining-custom-functions}
<div class='example'>
A simple [=custom function=] to negate a value can be defined as follows:
<pre class='lang-css'>
@function --negative (--value) {
@function --negative(--value) {
result: calc(-1 * var(--value));
}
</pre>
Expand Down Expand Up @@ -101,21 +101,25 @@ The ''@function'' rule defines a [=custom function=],
and its syntax is:

<pre class="prod def" nohighlight>
&lt;@function> = @function <<function-name>> [ ( <<function-parameter-list>> ) ]?
&lt;@function> = @function <<function-name>> <<function-parameter-list>>? )
[ using ( <<function-dependency-list>> ) ]?
[ returns <<css-type>> ]?
{
<<declaration-rule-list>>
}
<dfn><<function-name>></dfn> = <<dashed-ident>>
<dfn><<function-parameter-list>></dfn> = <<function-parameter>>#
<dfn><<function-dependency-list>></dfn> = <<function-parameter>>#
<dfn><<function-parameter>></dfn> = <<custom-property-name>> <<css-type>>? [ : <<declaration-value>> ]?
<dfn><<css-type>></dfn> = <<syntax-component>> | <<type()>>
<dfn>&lt;type()></dfn> = type( <<syntax>> )
</pre>

The <dfn><<function-name>></dfn> production
is a <<function-token>>,
with the additional restriction that it must start with two dashes
(U+002D HYPHEN-MINUS).

The name of the resulting [=custom function=] is given by the <<function-name>>,
the [=function parameters=] are optionally given by <<function-parameter-list>>,
the [=function dependencies=] are optionally given by <<function-dependency-list>>,
Expand Down

0 comments on commit fe94b66

Please sign in to comment.