@@ -446,6 +446,7 @@ The <dfn for=CSSUnparsedValue>indexed getter</dfn> retrieves the string fragment
446446[Constructor(DOMString value)]
447447interface CSSKeywordValue : CSSStyleValue {
448448 attribute DOMString value;
449+ stringifier;
449450};
450451</pre>
451452
@@ -454,59 +455,39 @@ interface CSSKeywordValue : CSSStyleValue {
454455 when called,
455456 perform the following steps:
456457
457- 1. [=Parse a component value=] from |value|,
458- and let |keyword| be the result.
459-
460- 2. If |keyword| is a syntax error,
461- [=throw=] a {{SyntaxError}} .
462-
463- 3. If |keyword| is anything but an [=identifier=] ,
464- [=throw=] a {{SyntaxError}} .
465-
466- 4. Otherwise, return a new {{CSSKeywordValue}}
458+ 1. Return a new {{CSSKeywordValue}}
467459 with its {{CSSKeywordValue/value}} internal slot
468- set to the serialization of |keyword |.
460+ set to |value |.
469461</div>
470462
471- <div class=issue>
472- It's intentional that this does a CSS parse,
473- rather than just taking the string literally.
463+ <div algorithm="CSSKeywordValue stringification behavior">
464+ The <dfn for=CSSKeywordValue>stringification behavior</dfn> of a {{CSSKeywordValue}} |this| is:
474465
475- Goals are (1) allow .value to round-trip thru the constructor,
476- and (2) allow .value to work when stitched directly into a string
477- that's then fed to CSS.
478- #2 requires us to have .value contain the appropriate CSS escapes,
479- and #1 then requires us to parse those escapes.
466+ 1. Let |token| be an <<ident-token>>
467+ with its value set to |this|’s {{CSSKeywordValue/value}} internal slot.
480468
481- On the other hand,
482- I think this conflicts with the most desirable handling of CSS strings;
483- a CSSStringValue should take the value literally, I think.
484- (Otherwise we have to do some weird things around quotes, I think.)
485- Need to evaluate this holistically.
486-
487- Possible solution: different behavior between .value
488- and the stringifier.
469+ 2. Return the serialization of |token|.
489470</div>
490471
491- <div algorithm for="CSSKeywordValue.value">
492- The <dfn attribute for=CSSKeywordValue>value</dfn> attribute of a {{CSSKeywordValue}} |this| must,
493- on setting a value |value|,
494- perform the following steps:
495-
496- 1. [=Parse a component value=] from |value|,
497- and let |keyword| be the result.
472+ Any place that accepts a {{CSSKeywordValue}}
473+ also accepts a raw {{DOMString}} ,
474+ by using the following typedef and algorithm:
498475
499- 2. If |keyword| is a syntax error,
500- [=throw=] a {{SyntaxError}} .
476+ <pre class=idl>
477+ typedef (DOMString or CSSKeywordValue) CSSKeywordish;
478+ </pre>
501479
502- 3. If |keyword| is anything but an [=identifier=] ,
503- [=throw=] a {{SyntaxError}} .
480+ <div algorithm>
481+ To <dfn export>rectify a keywordish value</dfn> |val|,
482+ perform the following steps:
504483
505- 4. Otherwise, set |this|’s internal {{CSSKeywordValue/value}} slot
506- to the serialization of |keyword |.
484+ 1. If |val| is a {{CSSKeywordValue}} ,
485+ return |val |.
507486
508- On reading, {{CSSKeywordValue/value}}
509- must return the serialization of |this|’s internal {{CSSKeywordValue/value}} slot.
487+ 2. If |val| is a {{DOMString}} ,
488+ return a new {{CSSKeywordValue}}
489+ with its {{CSSKeywordValue/value}} internal slot
490+ set to |val|.
510491</div>
511492
512493
0 commit comments