Re: [cssom] CSS Value API

On Thu, 22 Apr 2010 07:22:55 +0900, Ojan Vafai <ojan@chromium.org> wrote:
> What are cases where it can be converted?

E.g. a value is given in 'px' but you want to know how much 'em' that is  
for the current element.


> Are you thinking something like
> converting em to px? I don't think we should transparently do conversions
> like this. It would make sense if you had something like
> element.computedStyle.margin.l[0].px, but for declared styles it seems  
> like we should throw. If we do decide to convert, there should at least  
> be a
> simple way to check if the value is set in px, em, whatever without
> resorting to string parsing.

That would be the type attribute on CSSValue. For <length> it would have  
constants like LENGTH_PX.


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

Received on Thursday, 22 April 2010 04:50:25 UTC