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

On Friday 2015-02-20 02:41 +0000, Greg Whitworth wrote:
> 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

But the behavior of getAttribute() is covered by the DOM specs, not
the CSS ones.  The style attribute contains text that is interpreted
as CSS, and you can see that interpretation through element.style.
But getAtribute() is specified in the DOM specs to just return the
attribute as specified (unless other specifications say to change
the attribute at a particular time).  The behavior has nothing to do
with CSS.

(Gecko used to match the IE behavior where we discarded the original
text and then reconstructed it from the CSS information after a
getAttribute.)

I don't see anything specifying the attribute is changed in:
http://www.w3.org/html/wg/drafts/html/master/dom.html#the-style-attribute
and
http://dev.w3.org/csswg/cssom/#the-elementcssinlinestyle-interface
says:
  Mutating the declarations must set the style content attribute on
  the context object to the serialization of the declarations.
that is, that the DOM attribute (and the result of getAttribute())
changes only when the declarations accessed via element.style are
mutated.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Friday, 20 February 2015 03:12:21 UTC