@@ -48,6 +48,23 @@ dt + dt::before { content: ", "; }
48
48
dl:not(.switch) dt { display: inline; }
49
49
td > small { display: block; }
50
50
</style>
51
+ <style>
52
+ /* Put nice boxes around each algorithm. */
53
+ [data-algorithm] :not(.heading) {
54
+ padding: .5em;
55
+ border: thin solid #ddd; border-radius: .5em;
56
+ margin: .5em calc(-0.5em - 1px);
57
+ }
58
+ [data-algorithm] :not(.heading) > :first-child {
59
+ margin-top: 0;
60
+ }
61
+ [data-algorithm] :not(.heading) > :last-child {
62
+ margin-bottom: 0;
63
+ }
64
+ [data-algorithm] [data-algorithm] {
65
+ margin: 1em 0;
66
+ }
67
+ </style>
51
68
52
69
<h2 id="intro">
53
70
Introduction</h2>
@@ -3290,7 +3307,24 @@ Substitution</h3>
3290
3307
so no further [=arbitrary substitution functions=] exist in the sequence),
3291
3308
which it will be replaced by.
3292
3309
3293
- Note: See, for example, [=replace an if() function=] .
3310
+ <div class=note>
3311
+ A function's [=replacement=] algorithm is called
3312
+ with the results of [[#early-resolution|early substitution]]
3313
+ and parsing with the function's [=argument grammar=] ,
3314
+ but nothing more.
3315
+ The algorithm will have to further [=substitute=] each argument it deals with,
3316
+ before [=CSS/parsing=] it as the appropriate part of its <em> normal</em> grammar,
3317
+ and then performing whatever logic it needs.
3318
+
3319
+ It might leave some arguments completely unsubstituted
3320
+ (for example, the fallback argument of an ''attr()'' function,
3321
+ if the attribute value exists and correctly parses),
3322
+ or only parse some arguments based on the results of evaluating other arguments
3323
+ (for example, later <<if-condition>> values in an ''if()'' function
3324
+ are only evaluated if earlier ones evaluated as false,
3325
+ and only the result in the "successful" <<if-branch>> is evaluated).
3326
+ </div>
3327
+
3294
3328
3295
3329
<div algorithm>
3296
3330
To <dfn export local-lt="substitute|substitution" lt="substitute arbitrary substitution function|arbitrary substitution">substitute arbitrary substitution functions</dfn>
0 commit comments