@@ -13,6 +13,8 @@ Editor: Tab Atkins-Bittner, Google, http://xanthir.com/contact/, w3cid 42199
1313Abstract : This module defines the ability for authors to define custom functions, acting similar to <em>parametrized</em> custom properties. They can use the full power of CSS's values and conditional rules. It also defines an early form of a similar idea for CSS rule mixins, allowing parametrized substitution of entire blocks of properties into other rules.
1414Default Highlight : css
1515Ignored Terms : cssText
16+ WPT Path Prefix : css/css-mixins/
17+ WPT Display : open
1618</pre>
1719
1820<pre class=link-defaults>
@@ -35,7 +37,7 @@ spec:css-values-5; type:dfn;
3537 text:invalid at computed-value time
3638spec:cssom-1; type:dfn;
3739 text:specified order;
38- spec:css-conditional-5; type:at-rule;
40+ spec:css-conditional-5; type:at-rule;
3941 text:@container
4042</pre>
4143
@@ -127,6 +129,12 @@ Introduction {#intro}
127129 }
128130 </xmp>
129131
132+ <wpt>
133+ function-in-media.html
134+ local-inherit-substitution.html
135+ local-var-substitution.html
136+ </wpt>
137+
130138<!-- Big Text: @function
131139
132140 ████▌ █████▌ █▌ █▌ █ █▌ ███▌ █████▌ ████ ███▌ █ █▌
@@ -206,6 +214,12 @@ and optionally a <dfn>default value</dfn>.
206214<dfn function lt="type()" for="@function"><type()></dfn> = type( <<syntax>> )
207215</pre>
208216
217+ <wpt>
218+ at-function-parsing.html
219+ dashed-function-named-arg.tentative.html
220+ dashed-function-parsing.html
221+ </wpt>
222+
209223If a [=default value=] and a [=parameter type=] are both provided,
210224then the [=default value=] must [=CSS/parse=] successfully
211225according to that [=parameter type=] 's syntax.
@@ -455,6 +469,16 @@ is the real element at the root of the [=calling context=] stack.
455469 of the value resulting from the evaluation.
456470</div>
457471
472+ <wpt>
473+ dashed-function-eval.html
474+ dashed-function-standard-property.html
475+ function-attr.html
476+ function-shadow-animations.html
477+ function-shadow-cache.html
478+ function-shadow-container.html
479+ function-shadow.html
480+ </wpt>
481+
458482<div class='example'>
459483 A [=comma-containing productions|comma-containing value=]
460484 may be passed as a single argument
@@ -610,6 +634,12 @@ with its [=function parameters=] overriding "inherited" custom properties of the
610634 14. Return the value of the '@function/result' property in |body styles|.
611635</div>
612636
637+ <wpt>
638+ dashed-function-cycles.html
639+ local-attr-substitution.html
640+ local-if-substitution.html
641+ </wpt>
642+
613643<div algorithm>
614644 To <dfn>resolve function styles</dfn> ,
615645 given a [=custom function=] |custom function|,
@@ -763,6 +793,15 @@ at the [=conditional group rule=]'s location
763793when the condition is true,
764794or acting as if nothing exists at that location otherwise.
765795
796+ <wpt>
797+ function-conditionals.html
798+ function-container-dynamic.html
799+ function-container-self.html
800+ function-container-style.html
801+ function-layer.html
802+ function-media-dynamic.html
803+ </wpt>
804+
766805<div class='example'>
767806 <pre class='lang-css'>
768807 @function --suitable-font-size() {
@@ -827,6 +866,13 @@ but rather than extending/upgrading [=custom properties=],
827866[=mixins=] extend/upgrade [=nested style rules=] ,
828867making them reusable and customizable with arguments.
829868
869+ <wpt>
870+ mixin-basic.html
871+ mixin-declarations.html
872+ mixin-parsing.html
873+ mixin-shadow-dom.html
874+ </wpt>
875+
830876<div class=example>
831877 For example, the following code sets up a mixin
832878 applying all the properties you need for a "gradient text" effect,
@@ -908,6 +954,11 @@ save that it lacks a [=custom function/return type=].)
908954 }
909955</pre>
910956
957+ <wpt>
958+ mixin-media-query-invalidation-2.html
959+ mixin-media-query-invalidation.html
960+ </wpt>
961+
911962Differing from the ''@function'' rule,
912963the final item in the parameters list
913964can be the <<at-keyword-token>> ''@contents'' ,
@@ -956,6 +1007,10 @@ within a [=mixin body=].
9561007Unknown properties and rules are invalid and ignored,
9571008but do not make the ''@mixin'' rule itself invalid.
9581009
1010+ <wpt>
1011+ mixin-layers.html
1012+ </wpt>
1013+
9591014<!-- Big Text: params
9601015
9611016████▌ ███▌ ████▌ ███▌ █ █ ███▌
@@ -1201,6 +1256,12 @@ The syntax of a ''@contents'' at-rule is:
12011256 <<@contents>> = @contents [ { <<declaration-list>> } ]?
12021257</pre>
12031258
1259+ <wpt>
1260+ contents-nested-declarations-fallback.html
1261+ contents-nested-declarations.html
1262+ contents-rule.html
1263+ </wpt>
1264+
12041265That is, it is either an <em> empty</em> statement ended immediately by a semicolon,
12051266or a block treated as a [=nested declarations rule=] .
12061267The empty statement form behaves identically to passing an empty block.
@@ -1261,6 +1322,13 @@ is substituted into the body of another [=style rule=]
12611322as a [=nested declarations rule=]
12621323via the ''@apply'' rule.
12631324
1325+ <wpt>
1326+ apply-nested-declarations.html
1327+ mixin-cross-stylesheet.html
1328+ mixin-from-import-with-media-queries.html
1329+ mixin-from-import.html
1330+ </wpt>
1331+
12641332<!-- Big Text: @apply
12651333
12661334 ████▌ ███▌ ████▌ ████▌ █▌ █ ▐▌
@@ -1285,6 +1353,11 @@ Its grammar is:
12851353<<@apply>> = @apply [ <<dashed-ident>> | <<dashed-function>> ] [ { <<declaration-list>> } ]?;
12861354</pre>
12871355
1356+ <wpt>
1357+ apply-top-level.html
1358+ apply-within-mixin.html
1359+ </wpt>
1360+
12881361<div class=example>
12891362 For example, a [=mixin=] can be applied in any of these ways:
12901363
@@ -1527,6 +1600,11 @@ it's instead replaced with the [=guaranteed-invalid value=].
15271600CSSOM {#cssom}
15281601==============
15291602
1603+ <wpt>
1604+ at-function-cssom.html
1605+ function-invalidation.html
1606+ </wpt>
1607+
15301608The {{CSSFunctionRule}} Interface {#the-function-interface}
15311609-----------------------------------------------------------
15321610
@@ -1742,3 +1820,10 @@ Security Considerations {#security}
17421820===============================================
17431821
17441822No issues have been opened against this specification.
1823+
1824+ Changes {#changes}
1825+ ===============================================
1826+
1827+ Changes since the <a href="https://www.w3.org/TR/2025/WD-css-mixins-1-20250515/">First Public Working Draft of 15 May 2025</a> :
1828+
1829+ * Added Web Platform Tests coverage
0 commit comments