@@ -1202,15 +1202,17 @@ That is, it is either an <em>empty</em> statement ended immediately by a semicol
12021202or a block treated as a [=nested declarations rule=] .
12031203The empty statement form behaves identically to passing an empty block.
12041204
1205- If the [=mixin=] did not declare a ''@contents'' parameter,
1206- the ''@contents'' rule is ignored,
1207- substituting with nothing.
1208- Otherwise, if the ''@apply'' rule invoking the [=mixin=] passed a [=contents block=] ,
1209- the ''@contents'' is replaced with the [=contents block=] ,
1210- treating it as a [=nested declarations rule=] .
1211- Otherwise, if the ''@apply'' rule did not pass a [=contents block=] ,
1212- the ''@contents'' rule is replaced with its own <<declaration-list>> ,
1213- treated as a [=nested declarations rule=] .
1205+ * If the [=mixin=] did not declare a ''@contents'' parameter,
1206+ the ''@contents'' rule is ignored,
1207+ substituting with nothing.
1208+ <span class=note> (And if the ''@apply'' rule tries to pass a [=contents blocks=] ,
1209+ it's an invalid invocation and has no effect.)</span>
1210+ * Otherwise, if the ''@apply'' rule invoking the [=mixin=] passed a [=contents block=] ,
1211+ the ''@contents'' is replaced with the [=contents block=] ,
1212+ treating it as a [=nested declarations rule=] .
1213+ * Otherwise, if the ''@apply'' rule did not pass a [=contents block=] ,
1214+ the ''@contents'' rule is replaced with its own <<declaration-list>> ,
1215+ treated as a [=nested declarations rule=] .
12141216
12151217Outside of a [=mixin body=] ,
12161218the ''@contents'' rule is invalid and ignored.
@@ -1280,6 +1282,26 @@ Its grammar is:
12801282<<@apply>> = @apply [ <<dashed-ident>> | <<dashed-function>> ] [ { <<declaration-list>> } ]?;
12811283</pre>
12821284
1285+ <div class=example>
1286+ For example, a [=mixin=] can be applied in any of these ways:
1287+
1288+ <pre highlight=css>
1289+ .foo {
1290+ @apply --one;
1291+ /* Invokes the --one mixin, with no arguments or contents. */
1292+
1293+ @apply --two(blue);
1294+ /* Invokes --two with one argument, and no contents. */
1295+
1296+ @apply --three {color: red;}
1297+ /* Invokes --three with no arguments, but with contents.
1298+
1299+ @apply --four(blue) {color: red;}
1300+ /* Invokes --four with both an argument and contents.
1301+ }
1302+ </pre>
1303+ </div>
1304+
12831305The ''@apply'' rule is only valid
12841306in the body of a [=style rule=]
12851307or [=nested group rule=] ;
@@ -1313,6 +1335,40 @@ If the [=mixin=] did not declare a ''@contents'' parameter,
13131335having a <<declaration-list>> block makes the ''@apply'' rule invalid
13141336(similar to passing too many arguments).
13151337
1338+ <div class=example>
1339+ Applying a mixin without arguments, or with an empty argument list,
1340+ is identical.
1341+ That is, these two invocations do exactly the same thing:
1342+
1343+ <pre highlight=css>
1344+ .foo {
1345+ @apply --no-args;
1346+ }
1347+ .bar {
1348+ @apply --no-args();
1349+ }
1350+ </pre>
1351+
1352+ Passing a [=contents block=] is <em> not</em> the same;
1353+ omitting the block entirely triggers fallback,
1354+ while passing an empty block will substitute the empty block:
1355+
1356+ <pre highlight=css>
1357+ @mixin --just-contents(@contents) {
1358+ @contents { content: "This is fallback." }
1359+ }
1360+
1361+ .foo {
1362+ @apply --just-contents;
1363+ /* substitutes with `content: "This is fallback.";` */
1364+ }
1365+ .bar {
1366+ @apply --just-contents {};
1367+ /* substitutes with nothing at all */
1368+ }
1369+ </pre>
1370+ </div>
1371+
13161372
13171373<!-- Big Text: @env
13181374
0 commit comments