Re: [cssom] CSS Value API

On Wed, 07 Apr 2010 15:34:35 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 4/7/10 5:08 AM, Anne van Kesteren wrote:
>> The idea is that it sets the first value of the shorthand
>
> That's fine.  My specific question is:
>
>    <div id="x" style="margin-top: 15%">
>    <script>
>      document.getElementById("x").style.margin.l[0].px++;
>      // What just happened in the line above?
>    </script>

I think in this case you cannot convert and it would either throw or set  
the pixel value to 1. Not sure which way is better.

Your example makes me wonder though how shorthand and individual  
properties should interact. Maybe 'margin' should be a map and we should  
not try to recreate syntax-level features at the CSSOM-level. Now I  
phrased it like this I wonder why I ever thought otherwise. :-) I.e. the  
above would become style.margin.m.top.px++. We could even have  
margin.m.all.px++ or something to increase all individual properties if we  
ever wanted to simplify that.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Wednesday, 7 April 2010 15:22:36 UTC