Skip to content

Commit f972d5f

Browse files
committed
Make the 'match a grammar' algo a little more precise/correct.
1 parent 1124efb commit f972d5f

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

css-typed-om/Overview.bs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ probably in an appendix.
605605
Return |value|'s associated value.
606606

607607
: If |value| is a {{CSSStyleValue}} subclass,
608-
:: If |value| does not [=match a CSS production|match the grammar=] of a [=list-valued property iteration=] of |property|,
608+
:: If |value| does not [=match a grammar|match the grammar=] of a [=list-valued property iteration=] of |property|,
609609
[=throw=] a {{TypeError}}.
610610

611611
If any component of |property|’s CSS grammar has a limited numeric range,
@@ -623,15 +623,34 @@ probably in an appendix.
623623
</div>
624624

625625
<div algorithm>
626-
A {{CSSStyleValue}} is said to <dfn>match a CSS production</dfn>
626+
CSS properties express their valid inputs with grammars,
627+
which are written with the assumption of being matched against strings parsed into CSS tokens,
628+
as defined in [[css-syntax-3/#tokenization]].
629+
{{CSSStyleValue}} objects can also be matched against these grammars, however.
630+
631+
A {{CSSStyleValue}} is said to <dfn for=CSSStyleValue>match a grammar</dfn>
627632
based on the following rules:
628633

629-
* A {{CSSKeywordValue}} always matches <<ident>>.
630-
* A {{CSSTransformValue}} always matches <<transform-list>>.
631-
* A {{CSSPositionValue}} always matches <<position>>.
634+
* A {{CSSKeywordValue}} matches an [=ident=] specified in a grammar
635+
if its {{CSSKeywordValue/value}} internal slot
636+
matches the [=ident=].
637+
638+
If case-folding rules are in effect normally for that [=ident=]
639+
(such as ''Auto'' matching the keyword ''auto'' specified in the grammar for 'width'),
640+
they apply to this comparison as well.
641+
* A {{CSSTransformValue}} matches <<transform-list>>.
642+
* A {{CSSPositionValue}} matches <<position>>.
632643
* A {{CSSNumericValue}} matches what its type [=CSSNumericValue/matches=].
633-
* A {{CSSURLImageValue}} always matches <<url>>.
634-
* Any subclass of {{CSSImageValue}} always matches <<image>>.
644+
* A {{CSSURLImageValue}} matches <<url>>.
645+
* Any subclass of {{CSSImageValue}} matches <<image>>.
646+
* A {{CSSUnparsedValue}} matches any grammar.
647+
* A direct {{CSSStyleValue}} object (not a subclass)
648+
with a non-null {{CSSStyleValue/[[associatedProperty]]}} slot
649+
matches the grammar of the property specified in its {{CSSStyleValue/[[associatedProperty]]}} slot,
650+
regardless of what it is.
651+
652+
Note: As the ability to create more complex values in Typed OM increases,
653+
this section will become more complex.
635654
</div>
636655

637656
A [=string=] is a <dfn>custom property name string</dfn>

0 commit comments

Comments
 (0)