W3C home > Mailing lists > Public > www-style@w3.org > February 2012

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 15 Feb 2012 17:09:12 -0500
Message-ID: <4F3C2D08.1020600@mit.edu>
To: Glenn Adams <glenn@skynav.com>
CC: www-style list <www-style@w3.org>
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?


>     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.

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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:12 UTC