Skip to content

Commit ecfcbf9

Browse files
committed
[typed-om] Enforce that properties can only be .set() to a single CSSUnparsedValue. Prevent .append() from setting them at all, to avoid a nastier dependence on the existing values that makes it unpredictable whether appending is valid or not.
1 parent efd1851 commit ecfcbf9

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

css-typed-om/Overview.bs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,18 @@ probably in an appendix.
479479
and that slot's value is anything other than |property|,
480480
[=throw=] a {{TypeError}}.
481481

482+
5. If the [=list/size=] of |values| is two or more,
483+
and one or more of the [=list/items=] are a {{CSSUnparsedValue}} or {{CSSVariableReferenceValue}} object,
484+
[=throw=] a {{TypeError}}.
485+
486+
Note: When a property is set via string-based APIs,
487+
the presence of ''var()'' in a property
488+
prevents the entire thing from being interpreted.
489+
In other words,
490+
everything *besides* the ''var()'' is a plain [=component value=],
491+
not a meaningful type.
492+
This step's restriction preserves the same semantics in the Typed OM.
493+
482494
5. Let |props| be the value of |this|’s {{[[declarations]]}} internal slot.
483495

484496
6. If |props|[|property|] [=map/exists=],
@@ -513,14 +525,27 @@ probably in an appendix.
513525

514526
4. If any of the [=list/items=] in |values| have a non-null {{[[associatedProperty]]}} internal slot,
515527
and that slot's value is anything other than |property|,
528+
[=throw=] a {{TypeError}}.
529+
530+
5. If any of the [=list/items=] in |values|
531+
are a {{CSSUnparsedValue}} or {{CSSVariableReferenceValue}} object,
516532
[=throw=] a {{TypeError}}.
517533

534+
Note: When a property is set via string-based APIs,
535+
the presence of ''var()'' in a property
536+
prevents the entire thing from being interpreted.
537+
In other words,
538+
everything *besides* the ''var()'' is a plain [=component value=],
539+
not a meaningful type.
540+
This step's restriction preserves the same semantics in the Typed OM.
541+
518542
5. Let |props| be the value of |this|’s {{[[declarations]]}} internal slot.
519543

520544
6. If |props|[|property|] does not [=map/exist=],
521545
[=map/set=] |props|[|property|] to an empty [=list=].
522546

523-
Issue: Define the global.
547+
7. If |props|[|property|] contains a ''var()'' reference,
548+
[=throw=] a {{TypeError}}.
524549

525550
7. Let |temp values| be an empty [=list=].
526551

0 commit comments

Comments
 (0)