Skip to content

Commit 5c2f26b

Browse files
committed
[css-values-4] Properly define valdef notation for functional notations. w3c#2921
1 parent a5a01b0 commit 5c2f26b

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

css-values-4/Overview.bs

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ Component Value Types</h3>
118118
These are written as the function's name,
119119
followed by an empty parentheses pair,
120120
between <css>&lt;</css> and <css>></css>,
121-
e.g. <<calc()>>.
121+
e.g. <<calc()>>,
122+
and references the correspondingly-named [=functional notation=].
122123

123124
5. Other non-terminals.
124125
These are written as the name of the non-terminal
@@ -340,6 +341,58 @@ Component Values and White Space</h3>
340341
In this case, a space would be required before the ''2''
341342
to get this parsed as the two lengths ''1em'' and ''2em''.
342343

344+
345+
<h3 id="component-functions">
346+
Functional Notation Definitions</h3>
347+
348+
The syntax of a [=functional notation=] is defined
349+
as a sequence of:
350+
351+
1. The function's name written as an identifier
352+
followed by an open parenthesis
353+
(such as ''example(''),
354+
or the <<function-token>> production
355+
to indicate a function with an arbitrary name.
356+
357+
2. The function's arguments, if any,
358+
expressed using the [=value definition syntax=].
359+
360+
3. A literal closing parenthesis.
361+
362+
The function’s arguments are considered <em>implicitly grouped</em>,
363+
as if surrounded by brackets (''[ ... ]'').
364+
365+
<div class=example>
366+
For example, a grammar like:
367+
368+
<xmp class=prod>
369+
example( <length> , <length> )
370+
</xmp>
371+
372+
will match a function whose name is "example"
373+
and whose arguments match "<<length>> , <<length>>".
374+
</div>
375+
376+
<div class=example>
377+
For example, the Selectors grammar defines pseudo-classes generically,
378+
allowing any possibly function name after the initial colon:
379+
380+
<xmp class=prod>
381+
<pseudo-class-selector> = ':' <ident-token> | ':' <function-token> <any-value> ')'
382+
</xmp>
383+
384+
This represents <em>any</em> function name,
385+
with <<any-value>> as the function arguments.
386+
</div>
387+
388+
<div class="example">
389+
Since the [=functional notation=] <em>implicitly groups</em> its contents,
390+
the effect of any combinator inside it
391+
is scoped to the function’s argument.
392+
For example, the [=functional notation=] syntax definition
393+
''example( foo | bar )'' is equivalent to ''example( [ foo | bar ] )''.
394+
</div>
395+
343396
<h3 id="value-examples">
344397
Property Value Examples</h3>
345398

@@ -2867,6 +2920,7 @@ Functional Notations</h2>
28672920
immediately inside the parentheses.
28682921
Functions can take multiple arguments,
28692922
which are formatted similarly to a CSS property value.
2923+
See [[#component-functions]].
28702924

28712925
Note: Some legacy <a>functional notations</a>, such as ''rgba()'', use commas unnecessarily,
28722926
but generally commas are only used to separate items in a list,
@@ -2883,8 +2937,9 @@ Functional Notations</h2>
28832937
</pre>
28842938
</div>
28852939

2886-
The [=math functions=] are defined in [[#math]].
2887-
2940+
The [=math functions=] are defined below.
2941+
Other [=functional notations=] are defined in their own modules;
2942+
for example the [=color functions=] are defined in [[CSS-COLOR-4]].
28882943

28892944
<!--
28902945
██████ ███ ██ ██████ ███ ███

0 commit comments

Comments
 (0)