Skip to content

Commit 286463b

Browse files
committed
[css-properties-values-api] Move @Property to before the JS version.
1 parent 3478f73 commit 286463b

File tree

1 file changed

+171
-171
lines changed

1 file changed

+171
-171
lines changed

css-properties-values-api/Overview.bs

+171-171
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,177 @@ and [[css-syntax-3#tokenization|tokenizing]] the resulting string.
351351
</div>
352352

353353

354+
355+
<!--
356+
███████ ████████ ████████ ███████ ████████ ████████ ████████ ████████ ██ ██
357+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
358+
██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████
359+
██ ███ ██ ████████ ████████ ██ ██ ████████ ██████ ████████ ██ ██
360+
██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
361+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
362+
███████ ██ ██ ██ ███████ ██ ████████ ██ ██ ██ ██
363+
-->
364+
365+
The <dfn>@property</dfn> Rule {#at-property-rule}
366+
=================================================
367+
368+
The ''@property'' rule provides an alternative way to register a custom property,
369+
directly in a stylesheet
370+
without having to run any JS.
371+
Valid ''@property'' rules result in a [=register a custom property|registered custom property=],
372+
as if {{registerProperty()}} had been called with equivalent parameters.
373+
374+
The semantics of registered properties are the same
375+
regardless of the mechanism used to perform the registration.
376+
This means that, once registered,
377+
it does not matter whether the registration originated from {{registerProperty()}} or ''@property'':
378+
the property has the same behavior either way.
379+
380+
The syntax of ''@property'' is:
381+
382+
<pre class="prod def" nohighlight>
383+
@property <<custom-property-name>> {
384+
<<declaration-list>>
385+
}
386+
</pre>
387+
388+
''@property'' rules require a 'syntax' and 'inherits' descriptor;
389+
if either are missing,
390+
the entire rule is invalid and must be ignored.
391+
The 'initial-value' descriptor is optional
392+
only if the syntax is the [=universal syntax definition=],
393+
otherwise the descriptor is required;
394+
if it's missing, the entire rule is invalid and must be ignored.
395+
396+
Unknown descriptors are invalid and ignored,
397+
but do not invalidate the ''@property'' rule.
398+
399+
If multiple valid ''@property'' rules are defined for the same <<custom-property-name>>,
400+
the last one in stylesheet order "wins".
401+
A custom property registration from {{registerProperty()|CSS.registerProperty()}}
402+
further wins over any ''@property'' rules
403+
for the same <<custom-property-name>>.
404+
405+
A ''@property'' is invalid if it occurs in a stylesheet inside of a [=shadow tree=],
406+
and must be ignored.
407+
408+
Note: This might change in the future,
409+
as the behavior of concept-defining at-rules in shadow trees
410+
becomes more consistently defined.
411+
412+
The 'syntax' Descriptor {#the-syntax-descriptor}
413+
------------------------------------------------
414+
415+
<pre class='descdef'>
416+
Name: syntax
417+
Value: <<string>>
418+
For: @property
419+
Initial: n/a (see prose)
420+
</pre>
421+
422+
Specifies the syntax of the custom property,
423+
in the form defined by [[#syntax-strings]].
424+
This descriptor is equivalent to the {{PropertyDescriptor/syntax|syntax}} member of {{PropertyDescriptor}}.
425+
426+
The 'syntax' descriptor is required for the ''@property'' rule to be valid;
427+
if it's missing, the ''@property'' rule is invalid.
428+
429+
If the provided string does not successfully [=consume a syntax definition|parse as a syntax definition=],
430+
the descriptor is invalid and must be ignored.
431+
432+
433+
The 'inherits' Descriptor {#inherits-descriptor}
434+
------------------------------------------------
435+
436+
<pre class='descdef'>
437+
Name: inherits
438+
Value: true | false
439+
For: @property
440+
Initial: n/a (see prose)
441+
</pre>
442+
443+
Specifies whether or not the custom property inherits.
444+
This is equivalent to the {{PropertyDescriptor/inherits}} member of {{PropertyDescriptor}}.
445+
446+
The inherits descriptor is required for the ''@property'' rule to be valid;
447+
if it's missing, the ''@property'' rule is invalid.
448+
449+
450+
The 'initial-value' Descriptor {#initial-value-descriptor}
451+
----------------------------------------------------------
452+
453+
<pre class='descdef'>
454+
Name: initial-value
455+
Value: <<declaration-value>>
456+
For: @property
457+
Initial: the [=guaranteed-invalid value=] (but see prose)
458+
</pre>
459+
460+
Specifies the [=initial value=] of the custom property.
461+
This is equivalent to the {{PropertyDescriptor/initialValue}} member of {{PropertyDescriptor}}.
462+
463+
If the value of the 'syntax' descriptor is the [=universal syntax definition=],
464+
then the 'initial-value' descriptor is optional.
465+
If omitted, the initial value of the property is the [=guaranteed-invalid value=].
466+
467+
Otherwise,
468+
if the value of the 'syntax' descriptor is not the [=universal syntax definition=],
469+
the following conditions must be met for the the ''@property'' rule to be valid:
470+
471+
* The 'initial-value' descriptor must be present.
472+
* The 'initial-value' descriptor's value must [=consume a syntax definition|parse successfully=]
473+
according to the grammar specified by the [=syntax definition=].
474+
* The 'initial-value' must be [=computationally independent=].
475+
476+
If the above conditions are not met, the ''@property'' rule is invalid.
477+
478+
479+
Extensions to the {{CSSRule}} Interface {#extensions-to-css-rule-interface}
480+
------------------------------------------------------------------------------------
481+
482+
The {{CSSRule}} interface is extended as follows:
483+
484+
<pre class='idl'>
485+
partial interface CSSRule {
486+
const unsigned short PROPERTY_RULE = 18;
487+
};
488+
</pre>
489+
490+
The <dfn interface>CSSPropertyRule</dfn> Interface {#the-css-property-rule-interface}
491+
-----------------------------------------------------------------------------
492+
493+
The {{CSSPropertyRule}} interface represents an ''@property'' rule.
494+
495+
<pre class='idl' export>
496+
[Exposed=Window]
497+
interface CSSPropertyRule : CSSRule {
498+
readonly attribute CSSOMString name;
499+
readonly attribute CSSOMString syntax;
500+
readonly attribute boolean inherits;
501+
readonly attribute CSSOMString? initialValue;
502+
};
503+
</pre>
504+
505+
<dl dfn-for=CSSPropertyRule dfn-type=attribute>
506+
<dt><dfn>name</dfn>
507+
<dd>
508+
The custom property name associated with the ''@property'' rule.
509+
510+
<dt><dfn>syntax</dfn>
511+
<dd>
512+
The syntax associated with the ''@property'', exactly as specified.
513+
514+
<dt><dfn>inherits</dfn>
515+
<dd>
516+
The inherits descriptor associated with the ''@property'' rule.
517+
518+
<dt><dfn>initialValue</dfn>
519+
<dd>
520+
The initial value associated with the ''@property'' rule,
521+
which may not be present.
522+
</dl>
523+
524+
354525
<!--
355526
██ ██████
356527
██ ██ ██
@@ -992,177 +1163,6 @@ CSSOM {#cssom}
9921163

9931164

9941165

995-
<!--
996-
███████ ████████ ████████ ███████ ████████ ████████ ████████ ████████ ██ ██
997-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
998-
██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████
999-
██ ███ ██ ████████ ████████ ██ ██ ████████ ██████ ████████ ██ ██
1000-
██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1001-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1002-
███████ ██ ██ ██ ███████ ██ ████████ ██ ██ ██ ██
1003-
-->
1004-
1005-
The <dfn>@property</dfn> Rule {#at-property-rule}
1006-
=================================================
1007-
1008-
The ''@property'' rule provides an alternative way to register a custom property,
1009-
directly in a stylesheet
1010-
without having to run any JS.
1011-
Valid ''@property'' rules result in a [=register a custom property|registered custom property=],
1012-
as if {{registerProperty()}} had been called with equivalent parameters.
1013-
1014-
The semantics of registered properties are the same
1015-
regardless of the mechanism used to perform the registration.
1016-
This means that, once registered,
1017-
it does not matter whether the registration originated from {{registerProperty()}} or ''@property'':
1018-
the property has the same behavior either way.
1019-
1020-
The syntax of ''@property'' is:
1021-
1022-
<pre class="prod def" nohighlight>
1023-
@property <<custom-property-name>> {
1024-
<<declaration-list>>
1025-
}
1026-
</pre>
1027-
1028-
''@property'' rules require a 'syntax' and 'inherits' descriptor;
1029-
if either are missing,
1030-
the entire rule is invalid and must be ignored.
1031-
The 'initial-value' descriptor is optional
1032-
only if the syntax is the [=universal syntax definition=],
1033-
otherwise the descriptor is required;
1034-
if it's missing, the entire rule is invalid and must be ignored.
1035-
1036-
Unknown descriptors are invalid and ignored,
1037-
but do not invalidate the ''@property'' rule.
1038-
1039-
If multiple valid ''@property'' rules are defined for the same <<custom-property-name>>,
1040-
the last one in stylesheet order "wins".
1041-
A custom property registration from {{registerProperty()|CSS.registerProperty()}}
1042-
further wins over any ''@property'' rules
1043-
for the same <<custom-property-name>>.
1044-
1045-
A ''@property'' is invalid if it occurs in a stylesheet inside of a [=shadow tree=],
1046-
and must be ignored.
1047-
1048-
Note: This might change in the future,
1049-
as the behavior of concept-defining at-rules in shadow trees
1050-
becomes more consistently defined.
1051-
1052-
The 'syntax' Descriptor {#the-syntax-descriptor}
1053-
------------------------------------------------
1054-
1055-
<pre class='descdef'>
1056-
Name: syntax
1057-
Value: <<string>>
1058-
For: @property
1059-
Initial: n/a (see prose)
1060-
</pre>
1061-
1062-
Specifies the syntax of the custom property,
1063-
in the form defined by [[#syntax-strings]].
1064-
This descriptor is equivalent to the {{PropertyDescriptor/syntax|syntax}} member of {{PropertyDescriptor}}.
1065-
1066-
The 'syntax' descriptor is required for the ''@property'' rule to be valid;
1067-
if it's missing, the ''@property'' rule is invalid.
1068-
1069-
If the provided string does not successfully [=consume a syntax definition|parse as a syntax definition=],
1070-
the descriptor is invalid and must be ignored.
1071-
1072-
1073-
The 'inherits' Descriptor {#inherits-descriptor}
1074-
------------------------------------------------
1075-
1076-
<pre class='descdef'>
1077-
Name: inherits
1078-
Value: true | false
1079-
For: @property
1080-
Initial: n/a (see prose)
1081-
</pre>
1082-
1083-
Specifies whether or not the custom property inherits.
1084-
This is equivalent to the {{PropertyDescriptor/inherits}} member of {{PropertyDescriptor}}.
1085-
1086-
The inherits descriptor is required for the ''@property'' rule to be valid;
1087-
if it's missing, the ''@property'' rule is invalid.
1088-
1089-
1090-
The 'initial-value' Descriptor {#initial-value-descriptor}
1091-
----------------------------------------------------------
1092-
1093-
<pre class='descdef'>
1094-
Name: initial-value
1095-
Value: <<declaration-value>>
1096-
For: @property
1097-
Initial: the [=guaranteed-invalid value=] (but see prose)
1098-
</pre>
1099-
1100-
Specifies the [=initial value=] of the custom property.
1101-
This is equivalent to the {{PropertyDescriptor/initialValue}} member of {{PropertyDescriptor}}.
1102-
1103-
If the value of the 'syntax' descriptor is the [=universal syntax definition=],
1104-
then the 'initial-value' descriptor is optional.
1105-
If omitted, the initial value of the property is the [=guaranteed-invalid value=].
1106-
1107-
Otherwise,
1108-
if the value of the 'syntax' descriptor is not the [=universal syntax definition=],
1109-
the following conditions must be met for the the ''@property'' rule to be valid:
1110-
1111-
* The 'initial-value' descriptor must be present.
1112-
* The 'initial-value' descriptor's value must [=consume a syntax definition|parse successfully=]
1113-
according to the grammar specified by the [=syntax definition=].
1114-
* The 'initial-value' must be [=computationally independent=].
1115-
1116-
If the above conditions are not met, the ''@property'' rule is invalid.
1117-
1118-
1119-
Extensions to the {{CSSRule}} Interface {#extensions-to-css-rule-interface}
1120-
------------------------------------------------------------------------------------
1121-
1122-
The {{CSSRule}} interface is extended as follows:
1123-
1124-
<pre class='idl'>
1125-
partial interface CSSRule {
1126-
const unsigned short PROPERTY_RULE = 18;
1127-
};
1128-
</pre>
1129-
1130-
The <dfn interface>CSSPropertyRule</dfn> Interface {#the-css-property-rule-interface}
1131-
-----------------------------------------------------------------------------
1132-
1133-
The {{CSSPropertyRule}} interface represents an ''@property'' rule.
1134-
1135-
<pre class='idl' export>
1136-
[Exposed=Window]
1137-
interface CSSPropertyRule : CSSRule {
1138-
readonly attribute CSSOMString name;
1139-
readonly attribute CSSOMString syntax;
1140-
readonly attribute boolean inherits;
1141-
readonly attribute CSSOMString? initialValue;
1142-
};
1143-
</pre>
1144-
1145-
<dl dfn-for=CSSPropertyRule dfn-type=attribute>
1146-
<dt><dfn>name</dfn>
1147-
<dd>
1148-
The custom property name associated with the ''@property'' rule.
1149-
1150-
<dt><dfn>syntax</dfn>
1151-
<dd>
1152-
The syntax associated with the ''@property'', exactly as specified.
1153-
1154-
<dt><dfn>inherits</dfn>
1155-
<dd>
1156-
The inherits descriptor associated with the ''@property'' rule.
1157-
1158-
<dt><dfn>initialValue</dfn>
1159-
<dd>
1160-
The initial value associated with the ''@property'' rule,
1161-
which may not be present.
1162-
</dl>
1163-
1164-
1165-
11661166
<!--
11671167
████████ ██ ██ ███ ██ ██ ████████ ██ ████████ ██████
11681168
██ ██ ██ ██ ██ ███ ███ ██ ██ ██ ██ ██ ██

0 commit comments

Comments
 (0)