StyleValue in Typed OM

I have three comments about StyleValue in the Houdini Typed OM document:
the static parse() method returns either a StyleValue or a sequence of
StyleValues.
Two examples:

  background-image: linear-gradient(to top right, red, white, blue)

and

  width: calc(100% - 80px);

and

  font-family: Courier, "Lucida Console", monospace

To handle properly the individual values inside the functional notations
here, you'll need to have specific interfaces for everything we have
inside CSS, besides unit-based values I mean. attr, calc, gradients,
all. So Maybe you need here a generic CompoundStyleValue that holds
a string (for the functional notation part before the opening
parenthesis) and a sequence of StyleValues. Please note you also may
need a boolean indicating if the values are comma- or whitespace-
separated.

Next, how will you handle the comma-separated list in font-family?
Parsing is one thing but serialization is another one and you need to
keep track of the fact the values are comma-separated.

Furthermore, I recommend allowing the property argument passed to
StyleValue.parse() to be the empty string. In that case, validation
would not happen, allowing polyfills to handle value sets for properties
that don't exist in CSS (yet). I think you have an issue in the document
for that.

</Daniel>

Received on Wednesday, 2 December 2015 12:44:28 UTC