4 ms·
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#rules-for-parsing-a-legacy-color-value http://www.whatwg.org/specs/web-app
by supermatt 13y ago
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#rules-for-parsing-a-legacy-color-value http://www.whatwg.org/specs/web-apps/current-work/multipage/...
= ”red”
= 0red0 (" is not ascii so make 0)
= 00ed0 (r is not hex so make 0)
= 00ed00 (pad)
- meerita 13y agosuperb
- lucb1e 13y agoThat makes a great lot of sense, well explained! This should be on top of the comments. Edit: Heh
- Svip 13y agoThis neatly explains why `red` also becomes green.
- polymatter 13y agoAnd also explains why, "blue" is actually blue = "blue" = 0blue0 = 0b00e0
- hmottestad 13y ago"blue" is actually supposed to be blue. Like "yellow" or "green" or "black" it's ”blue” that is interesting.
- taf2 13y agoI prefer ”orange” to your ”blue” actually... much easier on the eyes.
- phektus 13y agoOh, nice explanation http://jsfiddle.net/pPCmG/ http://jsfiddle.net/pPCmG/
- JohnHaugeland 13y agoSorry, this isn't correct. Red is a perfectly valid color value. This is not about property expansion. This is because the source uses curly quotes, which are not recognized as a parameter bracketing, and so the curly quotes are trying to be interpreted as part of the value. Change the quotes to actual quotes and it starts working as expected.
- ender7 13y agoNo, the OP is correct. You're right that <red> is a valid CSS color keyword, but <”red”> is not. Because of this, the CSS spec treats it as a "legacy color value" and attempts to interpret it as a string of characters (including the quotes) rather than a keyword.
- beyti 13y agoyeap
- supermatt 13y agoThe quotes in my explanation are the 'curly' quotes. They just display differently on HN.
- xux 13y agoWhat's the point of having different quotation marks that are not ascii? Sounds like a formatting nightmare.
- chudesnov 13y agoTypography, duh.