WICG / css-parser-api

This is the repo where the CSS Houdini parser API will be worked on
Other
71 stars 14 forks source link

type returning value for multiple type set #4

Closed jeremenichelli closed 8 years ago

jeremenichelli commented 8 years ago

This is more a question and not an issue, what would type return when you have a property set with multiple values like this:

var styles = window.cssParse.ruleSet(".foo { padding: 5px 0 1em; }");
console.log(styles[0].styleMap.get("padding-left").type) // ?
console.log(styles[0].styleMap.get("padding").type) // ?
tabatkins commented 8 years ago

Since this API will be covering "generic" parsing (and so doesn't know anything about CSS itself or its properties), you'll get something like:

[CSSWhitespaceToken, CSSDimensionToken{value:2, unit:"px"}, CSSWhitespaceToken, CSSNumberToken{value:0},CSSWhitespaceToken, CSSDimensionToken{value:1, unit:"em"}]

when you ask for the "padding" value. You won't get anything for "padding-left", because the generic parser has no idea what shorthands are.