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

On Wed, Feb 15, 2012 at 3:45 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 2/15/12 5:37 PM, Glenn Adams wrote:
>
>> OK, just to be clear, your concerns regarding the CSSOM spec are that it
>> should either:
>>
>> (1) explicitly define support for use of the bracket notation for
>> property accessors for properties whose name is a style property defined
>> by CSSStyleDeclaration
>>
>> or
>>
>> (2) explicitly exclude such support
>>
>
> Sure, if you want to think of it that way.
>
> Note that (2) is somewhat difficult to define because sometimes the
> property name and the spec name are in fact the same (e.g. "display"). If
> WebKit and Trident drop their support for this stuff, then I don't think we
> need explicit action to spec (2).  If they don't we probably need explicit
> action to spec (1).
>
> Also note, this is not special to bracket notation.  In Javascript,
> style.float and style["float"] are completely identical; the former is just
> syntactic sugar for the latter.  So style["display"] works in all browsers.
>  style["fontSize"] works in all browsers.  style["cssFloat"] works in all
> browsers.  style["font-size"] or style["float"] do not.
>
>
>  Is this correct? Do you have a preference?
>>
>
> I'd somewhat prefer (2), obviously, since it's less work for me.  ;)
>
>
>  Regarding cssFloat vs float, are you suggesting that the spec should
>> explicitly exclude the use of float
>>
>
> There is no separate cssFloat vs float issue.  It's the same exact issue
> as the fontSize vs font-size issue.  See above.


Understood. At a minimum, it would be useful to document that the use of
raw style property names (e.g., float, font-size) are not sanctioned except
in the case that the raw style property name matches the defined member
name.

It may be useful to go further, and define a specific process that
normalizes raw style property names to member names that accommodates
future property definitions. One problem with the current set of style
property members is that it does not include new properties under
development or that may be added in the future.

Received on Wednesday, 15 February 2012 22:53:48 UTC