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

Re: [css-variables] How to spec the OM for vars?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 23 Aug 2012 18:22:37 -0700
Message-ID: <CAAWBYDDpOAtRBcmmVrRQVKXcHWq15L9T37Oi-_Yba37yZjcrcw@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style@w3.org
On Thu, Aug 23, 2012 at 6:12 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 8/23/12 5:46 PM, Tab Atkins Jr. wrote:
>> How can we do this in WebIDL?
> You can declare getters and setters that would live directly on the object
> in WebIDL to support open-ended sets of properties.  So basically something
> like this:
>   getter DOMString (DOMString varName);
>   setter void (DOMString varName, DOMString varValue);

That works nicely with the existing attributes, I assume?  Or do I
need to write the getter/setter to handle them as well?

> 1)  The interaction with web content that sets expandos on CSS declarations
> might be interesting.  Let's hope there's not too much of it.
> 2)  Using a getter and setter as above will not allow variable names to
> shadow properties on the proto chain.  So if you have a variable named
> getProperty, doing style.getProperty will still get you the function off the
> prototype.  And if you have a variable named "display", then style.display
> will still be the display property value, not the value of the variable.  I
> think this is in fact the behavior we want here.

Neither of these should be much of a problem.  All custom property
have a "var-" prefix, which translates to a "var and a capital letter"
prefix as a property.  So, I can just require that structure in the
getter/etc and bail otherwise.

Received on Friday, 24 August 2012 01:23:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:03 UTC