Re: [cssom] Supporting JS properties whose names are CSS property names on CSSDeclaration objects

On 2/15/12 4:57 PM, Glenn Adams wrote:
>     Apparently Trident (including in standards mode) and WebKit support
>     properties on their CSSDeclaration objects whose names are property
>     names.  Presto and Gecko do not.
>
> You are speaking of CSSStyleDeclaration, correct?

Yes.

>     What this means is that something like this:
>
>       document.body.style["font-size"] = "20px"
>
>     works in Trident and WebKit but not in Presto and Gecko.  Worse yet,
>     something like this:
>
>       document.getElementById("something").style.float = "right"
>
>     works in Trident and WebKit but not in Presto and Gecko.
>
> Perhaps I'm missing something here, but clearly the second of the above
> is consistent with the behavior defined by CSS2Properties as well as
> what has been drafted at CSSOM [1]

No, it's not.  If you actually look at the link, the property is called 
"cssFloat" in CSS2Properties, both in CSSOM and in the DOM 2 Style 
specs, because "float" is a reserved word in many languages.  Using 
style.cssFloat works in all browsers.

> while the first behavior is consistent with the treatment of item() as an ArrayClass.

Uh... no, it's not.  We're not using integer indices here.

> I agree that this latter behavior is not currently specified, and does
> need to be in CSSOM. What is the specific problem with the former? (is
> it related to the use of "cssFloat" vs "float"?)

I'm not sure what you mean by "latter" and "former" here.  My two 
examples both demonstrate the exact same behavior.  The only question is 
whether the spec should spec this behavior or whether Trident and WebKit 
are willing to drop it.

-Boris

Received on Wednesday, 15 February 2012 22:09:41 UTC