Skip to content

Commit 6d8135f

Browse files
authored
[css-mixins-1] Do arbitrary function substitution before evaluation (#11449)
The previous attempt at defining this ("do var()/etc first") is pretty clumsy, and doesn't really work when there's another dashed-function in the argument list. Also handle all arbitrary function substitution in "resolved local value", not just env() and attr().
1 parent c43a10e commit 6d8135f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

css-mixins-1/Overview.bs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,6 @@ At computed-value time,
234234
every <<dashed-function>> must be [=substitute a dashed function|substituted=]
235235
before finally being checked against the property's grammar.
236236

237-
When a value is being computed,
238-
substitution of ''var()'', ''env()'' and ''attr()''
239-
must take place <em>before</em> <<dashed-function>> substitution.
240-
241-
Note: This means arguments passed to a custom function
242-
never contain ''var()'', or similar functions.
243-
244237
A ''var()'' function within a [=local variable=],
245238
or within the ''@function/result'' descriptor,
246239
invokes [=locally substitute a var()|local substitution=],
@@ -266,10 +259,13 @@ described in [[!css-variables]].
266259
* Append the result of [=resolving an argument=] to |dependency values|,
267260
using |dependency value| as value,
268261
and |dependency| as parameter.
269-
4. [=Evaluate a custom function=],
262+
4. [=substitute arbitrary substitution functions|Substitute=]
263+
any [=arbitrary substitution functions=]
264+
within |dashed function|'s arguments.
265+
5. [=Evaluate a custom function=],
270266
using |function|, |dashed function| and |dependency values|.
271-
5. If failure was returned, return failure.
272-
6. Otherwise,
267+
6. If failure was returned, return failure.
268+
7. Otherwise,
273269
replace the <<dashed-function>> with the [=equivalent token sequence=]
274270
of the value resulting from the evaluation.
275271
</div>
@@ -408,8 +404,10 @@ Parameters and Locals {#parameters}
408404
A <dfn>resolved local value</dfn> is the value of a [=local variable=] or [=descriptor=], except:
409405

410406
* Any ''var()'' functions are replaced by [=locally substitute a var()|local substitution=].
411-
* Any ''env()'' or ''attr()'' functions are substituted normally.
412407
* Any <<dashed-function>>s are replaced by [=substitute a dashed function|dashed function substitution=].
408+
* Any [=arbitrary substitution functions=]
409+
other than ''var()'' and <<dashed-function>>s
410+
are substituted normally.
413411

414412
If any substitution algorithm returns failure,
415413
then the [=resolved local value=] of a [=local variable=]

0 commit comments

Comments
 (0)