[css-style-attr][CSS2.1] What should happen to values that are not valid

Hello everyone,

We found an interesting interop issue where Chrome/FF allow the style attribute to keep (instead of ignore) props and values that are not valid. Looking into the specs for this, CSS2.1 states that[1]:

	# This specification defines ignore to mean that the user agent parses the illegal part (in order to find its beginning and end), but otherwise acts as if it had not been there

Chrome/FF follows this for styles that are inserted into the CSSOM via stylesheets but keeps the attribute complete with incorrect values in the attribute even though the parsing of the style attribute states[2]:

	#Aside from the differences in cascading, the declarations in a style attribute must be interpreted exactly as if they were given in a CSS style rule that applies to the element.

So essentially (if I'm reading this correctly) you should get the same result when requesting what is on the style attribute and what is in the CSSOM.

I wrote up a test page that outputs the CSSOM info and what is in the style attribute, I've attached it to this email since JSFiddle or JSBin I would need to dig through a lot more stylesheets to find the right declarations (I also posted it on pastebin[3]).

Thanks for your input!

Greg

[1] http://www.w3.org/TR/CSS21/syndata.html#illegalvalues
[2] http://www.w3.org/TR/css-style-attr/
[3] http://pastebin.com/X2adfQ3M

Received on Friday, 20 February 2015 02:41:39 UTC