W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2010

Re: DOMString-like objects for the CSSOM

From: Maciej Stachowiak <mjs@apple.com>
Date: Tue, 23 Feb 2010 14:10:06 -0800
Cc: Brendan Eich <brendan@mozilla.org>, public-script-coord@w3.org
Message-id: <A10DD2B9-9F82-4883-93C6-712296660EE3@apple.com>
To: Anne van Kesteren <annevk@opera.com>

On Feb 23, 2010, at 2:49 AM, Anne van Kesteren wrote:

> On Sat, 20 Feb 2010 02:22:12 +0100, Maciej Stachowiak  
> <mjs@apple.com> wrote:
>> The other alternatives involve creating some parallel API, along one
>> of the following lines:
>>
>> foo.style.topValue.px = 200
>> foo.style.topPX = 200
>> foo.styleValues.top.px = 200
>>
>> Of these options, I think the last one is probably the best, because
>> it's easy to feature-test for from script. The only problem is that
>> "styleValues" is kind of a bad name. I'm sure there are better
>> possibilities though.
>
> I guess we should do something like that then.
>
> I personally think a new member on CSSStyleDeclaration would be  
> better so we do not need to introduce a whole new series of  
> accessors. Thoughts?

Good point, that would also make it work with getComputedStyle and the  
like. So something like:

foo.style.values.top.px
foo.style.properties.top.px

This does mean one extra property access compare to foo.style.top.px,  
and two more compared to foo.style.top. However, for repeated style  
access an author could (presumably) save foo.style.properties in a  
variable and just do properties.top.px.

Regards,
Maciej
Received on Tuesday, 23 February 2010 22:10:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:02 UTC