@@ -116,7 +116,7 @@ Introduction {#intro}
116
116
117
117
.foo {
118
118
--shadow-color: blue;
119
- box-shadow: --shadow(); // produces a blue shadow
119
+ box-shadow: --shadow(); /* produces a blue shadow */
120
120
/* or just */
121
121
box-shadow: --shadow(blue);
122
122
}
@@ -184,7 +184,7 @@ a list of [=function parameter|parameters=],
184
184
a <dfn for="custom function">function body</dfn> ,
185
185
and optionally a <dfn for="custom function">return type</dfn> described by a [=syntax definition=] .
186
186
187
- A <dfn>function parameter</dfn> consists of a name (<<custom-property-name>> );
187
+ Each <dfn>function parameter</dfn> consists of a name (<<custom-property-name>> );
188
188
optionally a <dfn>parameter type</dfn> , described by a [=syntax definition=] ;
189
189
and optionally a <dfn>default value</dfn> .
190
190
@@ -200,6 +200,9 @@ and optionally a <dfn>default value</dfn>.
200
200
<dfn function lt="type()" for="@function"><type()></dfn> = type( <<syntax>> )
201
201
</pre>
202
202
203
+ <h4 id=function-preamble>
204
+ The Function Preamble</h4>
205
+
203
206
The <<function-token>> production
204
207
must start with two dashes (U+002D HYPHEN-MINUS),
205
208
similar to <<dashed-ident>> ,
@@ -233,22 +236,27 @@ and the optional [=custom function/return type=] is given by the <<css-type>> fo
233
236
</div>
234
237
235
238
239
+ The name of a ''@function'' rule is a [=tree-scoped name=] .
236
240
If more than one ''@function'' exists for a given name,
237
241
then the rule in the stronger cascade layer wins,
238
242
and rules defined later win within the same layer.
239
243
240
- The name of a ''@function'' rule is a [=tree-scoped name=] .
241
-
242
244
If the <<function-parameter-list>>
243
245
contains the same <<custom-property-name>> more than once,
244
246
then the ''@function'' rule is invalid.
245
247
248
+ <h4 id=function-body>
249
+ The Function Body</h4>
250
+
246
251
The body of a ''@function'' rule accepts [=conditional group rules=] ,
247
252
such as ''@media'' .
248
253
Additionally, it accepts the following descriptors:
249
254
250
255
* The '@function/result' descriptor,
251
256
which determines the result of [=evaluating a custom function|evaluating the function=] .
257
+ If no '@function/result' descriptor exists,
258
+ the function is valid,
259
+ but always returns the [=guaranteed-invalid value=] .
252
260
* [=Custom properties=] ,
253
261
providing <dfn>local variables</dfn> .
254
262
@@ -266,14 +274,14 @@ Initial: n/a (see prose)
266
274
</pre>
267
275
268
276
The '@function/result' descriptor
269
- determines the result of [=evaluate a custom function|evaluating=]
270
- the [=custom function=] that is defined by a ''@function'' rule.
277
+ defines the result of [=evaluate a custom function|evaluating=]
278
+ the [=custom function=] defined by its ''@function'' rule.
271
279
Using ''var()'' functions,
272
280
it can reference [=function parameters=] , [=local variables=] ,
273
281
as well as other [=custom functions=] via <<dashed-function>> s.
274
282
275
283
The '@function/result' descriptor itself does not have a type,
276
- but its [=resolve function styles|resolved=] value is type checked
284
+ but its [=resolve function styles|resolved=] value is type- checked
277
285
during the [=substitute a dashed function|substitution=] of a <<dashed-function>> .
278
286
279
287
Arguments & Local Variables {#args}
@@ -294,11 +302,11 @@ In that list, earlier things "win" over later things of the same name--
294
302
if you have a [=local variable=] named '--foo' ,
295
303
''var(--foo)'' will be substituted by that [=local variable=] ,
296
304
not by an argument or a custom property defined outside.
297
- ( The other values can still be <em> accessed</em> , however:
305
+ The other values can still be <em> accessed</em> , however:
298
306
setting the '--foo' local variable to ''initial''
299
307
will resolve it to the '--foo' parameter,
300
308
while ''inherit'' will resolve it
301
- to the '--foo' custom property from the call site.)
309
+ to the '--foo' custom property from the call site.
302
310
303
311
<div class='example'>
304
312
A [=custom function=] can access [=local variables=]
0 commit comments