diff --git a/css-mixins-1/Overview.bs b/css-mixins-1/Overview.bs index b9619bad714..7d70fbb2484 100644 --- a/css-mixins-1/Overview.bs +++ b/css-mixins-1/Overview.bs @@ -1199,7 +1199,7 @@ The syntax of a ''@contents'' at-rule is: That is, it is either an empty statement ended immediately by a semicolon, -or a block treated as a [=nested declarations rule=]. +or a fallback block treated as a [=nested declarations rule=]. The empty statement form behaves identically to passing an empty block. * If the [=mixin=] did not declare a ''@contents'' parameter, @@ -1211,7 +1211,7 @@ The empty statement form behaves identically to passing an empty block. the ''@contents'' is replaced with the [=contents block=], treating it as a [=nested declarations rule=]. * Otherwise, if the ''@apply'' rule did not pass a [=contents block=], - the ''@contents'' rule is replaced with its own <>, + the ''@contents'' rule is replaced with its [=fallback block=], treated as a [=nested declarations rule=]. Outside of a [=mixin body=], @@ -1586,7 +1586,7 @@ appear as if wrapped in {{CSSFunctionDeclarations}} rules. Note: This also applies to the "leading" declarations in the ''@function'' rule, i.e those that do not follow another nested rule. -
+
 	@function --bar() {
 	  --x: 42;
@@ -1728,6 +1728,258 @@ The {{CSSFunctionDeclarations}} rule, like {{CSSNestedDeclarations}},
 [=serialize a CSS rule|serializes=] as if its [=CSS declaration block|declaration block=]
 had been [=serialize a CSS declaration block|serialized=] directly.
 
+The {{CSSMixinRule}} Interface {#the-mixin-interface}
+-----------------------------------------------------
+
+The {{CSSMixinRule}} interface represents a ''@mixin'' rule.
+
+
+[Exposed=Window]
+interface CSSMixinRule : CSSGroupingRule {
+	readonly attribute CSSOMString name;
+	sequence<FunctionParameter> getParameters();
+	readonly attribute boolean contents;
+};
+
+ +
+
name +
+ The result of [=serialize an identifier=] + on the [=mixin=]'s name. +
getParameters() +
+ Returns [=function parameters=] associated with the [=mixin=], + excluding any '@contents' parameter. +
+
contents +
+ True if the [=mixin=] accepts a [=contents block=], + and false otherwise. +
+ +While declarations may be specified directly within a ''@mixin'' rule, +they are not represented as such in the CSSOM. +Instead, consecutive segments of declarations +appear as if wrapped in {{CSSNestedDeclarations}} rules. +
+This is similar to +how segments of bare declarations +within '@function' are wrapped, +except with {{CSSNestedDeclarations}} as the wrapper +rather than {{CSSFunctionDeclarations}}. +
+ +
+To serialize a CSSMixinRule, +return the concatenation of the following: + + 1. The string "@mixin" followed by a single SPACE (U+0020). + 2. The result of performing serialize an identifier + on the name of the [=mixin=], + followed by a single LEFT PARENTHESIS (U+0028). + 3. The result of [=serialize a function parameter=] + on each of the [=mixin's=] [=function parameter|parameters=], + all joined by ", " + (COMMA U+002C, followed by a single SPACE U+0020). + 4. A single RIGHT PARENTHESIS (U+0029). + 5. A single LEFT CURLY BRACKET (U+007B), + followed by a SPACE (U+0020). + 6. The result of performing [=serialize a CSS rule=] + on each rule in cssRules, + filtering out empty strings, + all joined by a single SPACE (U+0020). + 7. A single SPACE (U+0020), + followed by a single RIGHT CURLY BRACKET (U+007D). +
+ +The {{CSSApplyBlockRule}} Interface {#the-apply-block-interface} +---------------------------------------------------------------- + +The {{CSSApplyBlockRule}} interface represents +an ''@apply'' rule with a [=contents block=]. + +
+[Exposed=Window]
+interface CSSApplyBlockRule : CSSGroupingRule {
+	readonly attribute CSSOMString name;
+	sequence<CSSOMString> getArguments();
+};
+
+ +
+
name +
+ If the ''@apply'' rule has an associated <>, + the result of [=serialize an identifier=] on that [=ident=]. + Otherwise, + the result of [=serialize an identifier=] on the name + of the associated <>. +
+
getArguments() +
+ Returns a sequence of arguments as strings, + each item [[css-variables-1#serializing-custom-props|serialized]] + as if it had been the specified value of a [=custom property=]. +
+
+ +The [=CSSRule/child CSS rules=] of a {{CSSApplyBlockRule}} +represent the [=contents block=] +of the ''@apply'' rule. + +As for {{CSSMixinRule}}, +consecutive segments of declarations +specified directly within the [=contents block=] of an ''@apply'' rule +are represented as {{CSSNestedDeclarations}}. + +
+To serialize a CSSApplyBlockRule, +return the concatenation of the following: + + 1. The string "@apply" followed by a single SPACE (U+0020). + 2. The result of performing [=serialize an @apply prelude=] + on the ''@apply'' rule. + 3. A single SPACE (U+0020). + 4. A single LEFT CURLY BRACKET (U+007B), + followed by a SPACE (U+0020). + 5. The result of performing [=serialize a CSS rule=] + on each rule in cssRules, + filtering out empty strings, + all joined by a single SPACE (U+0020). + 6. A single SPACE (U+0020), + followed by a RIGHT CURLY BRACKET (U+007D). +
+ +
+To serialize an @apply prelude, +given an ''@apply'' rule, +return the concatenation of the following: + + 1. The {{CSSApplyBlockRule/name}} of the ''@apply'' rule. + 2. If the ''@apply'' rule has at least one argument, + the concatenation of: + * A single LEFT PARENTHESIS (U+0028). + * The result of performing [=serialize a function argument=] + on each argument, + all joined by ", ". + * A single RIGHT PARENTHESIS (U+0029). +
+ +
+To serialize a function argument, +given a <> |argument|: + + 1. [[css-variables-1#serializing-custom-props|Serialize]] |argument| + as if it had been the specified value of a [=custom property=], + and let |serialized argument| be the result. +
+ This means that an argument serializes exactly as written, + except with leading and trailing whitespace removed. +
+ 2. If |serialized argument| does not contain any top-level <>s, + nor any top-level <<{-token>>s, + return |serialized argument|. + 3. Otherwise, return the concatenation of the following: + * A single LEFT CURLY BRACKET (U+007B), + followed by a SPACE (U+0020). + * The value of |serialized argument|. + * A single SPACE (U+0020), + followed by a RIGHT CURLY BRACKET (U+007D). + +
+ See [[css-values-5#component-function-commas]] for more information + on [=comma-containing productions=]. +
+
+ +The {{CSSApplyStatementRule}} Interface {#the-apply-statement-interface} +------------------------------------------------------------------------ + +The {{CSSApplyStatementRule}} interface represents +an ''@apply'' rule without a [=contents block=]. + +
+[Exposed=Window]
+interface CSSApplyStatementRule : CSSRule { 
+	readonly attribute CSSOMString name;
+	sequence<CSSOMString> getArguments();
+};
+
+ +
+
name +
+ The same as {{CSSApplyBlockRule/name|CSSApplyBlockRule.name}}. +
+
getArguments() +
+ The same as {{CSSApplyBlockRule/getArguments()|CSSApplyBlockRule.getArguments()}}. +
+
+ +
+To serialize a CSSApplyStatementRule, +return the concatenation of the following: + + 1. The string "@apply" followed by a single SPACE (U+0020). + 2. The result of performing [=serialize an @apply prelude=] + on the ''@apply'' rule. + 3. A single SEMICOLON (U+003B). +
+ +The {{CSSContentsBlockRule}} Interface {#the-contents-block-interface} +--------------------------------------------------------------------- + +The {{CSSContentsBlockRule}} interface represents +a ''@contents'' rule with a [=fallback block=]. + +
+[Exposed=Window]
+interface CSSContentsBlockRule : CSSGroupingRule { };
+
+ +The [=CSSRule/child CSS rules=] of a {{CSSContentsBlockRule}} +represent the [=fallback block=] +of the ''@contents'' rule. + +As for {{CSSMixinRule}} and {{CSSApplyBlockRule}}, +consecutive segments of declarations +specified directly within the [=fallback block=] of a ''@contents'' rule +are represented as {{CSSNestedDeclarations}}. + +
+To serialize a CSSContentsBlockRule, +return the concatenation of the following: + + 1. The string "@contents" followed by a single SPACE (U+0020). + 2. A single LEFT CURLY BRACKET (U+007B), + followed by a SPACE (U+0020). + 3. The result of performing [=serialize a CSS rule=] + on each rule in cssRules, + filtering out empty strings, + all joined by a single SPACE (U+0020). + 4. A single SPACE (U+0020), + followed by a RIGHT CURLY BRACKET (U+007D). +
+ +The {{CSSContentsStatementRule}} Interface {#the-contents-statement-interface} +------------------------------------------------------------------------------ + +The {{CSSContentsStatementRule}} interface represents +a ''@contents'' rule without a [=fallback block=]. + +
+[Exposed=Window]
+interface CSSContentsStatementRule : CSSRule { };
+
+ +
+To serialize a CSSContentsStatementRule, +return the string "@contents", +followed by a single SEMICOLON (U+003B). +
+ Privacy Considerations {#privacy} =============================================== diff --git a/cssom-1/Overview.bs b/cssom-1/Overview.bs index c0249153e30..222e25055fd 100644 --- a/cssom-1/Overview.bs +++ b/cssom-1/Overview.bs @@ -1808,7 +1808,7 @@ null.
A reference to a parent CSS style sheet or null. This item is initialized to reference an associated style sheet when the rule is created. It can be changed to null. -
child CSS rules +
child CSS rules
A list of child CSS rules. The list can be mutated.