- From: Ian Hickson <ian@hixie.ch>
- Date: Wed, 29 Dec 2010 23:07:32 +0000 (UTC)
On Wed, 22 Sep 2010, Boris Zbarsky wrote: > > Consider this code: > > gradient.addColorStop("1.0","rgba( 0, 0, 0, 0"); > > where |gradient| is a canvas radial gradient. Note the lack of ')' at the end > of the rgba string there. > > What's the correct behavior? The spec says: > > If the color cannot be parsed as a CSS color, then a SYNTAX_ERR > exception must be raised. > > However an actual CSS parser parsing that string as a color would infer the > closing ')' per CSS 2.1 section 4.2 the item about "unexpected EOF". Note > that this is a tokenization-level requirement, as far as I can tell, so this > happens before the syntax rules for productions like <color> are applied. > > Observed behavior in UAs is: > > * Webkit simply doesn't implement CSS 2.1 section 4.2 correctly > > * Opera throws an exception from the addColorStop call above, but shows > lime text if loading this: > data:text/html,<span style="color: rgb(0, 255, 0">Lime</span> > > * Gecko shows lime text in the HTML testcase and treats the color stop > above as valid rgba(0, 0, 0, 0). > > Clearly I happen to think Gecko's behavior is the sane one here, but > there's a clear interoperability problem either way. Certainly Opera > and Gecko interpreted the spec differently. Your interpretation is correct. I've fixed one point in the HTML spec that was phrased in terms of validity rather than in terms of successful parsing, and added a paragraph and example clarifying this, along with cross-references to this paragraph where relevant. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 29 December 2010 15:07:32 UTC