W3C home > Mailing lists > Public > www-style@w3.org > December 2009

Re: Proposal: getStyleAs(property, primitiveValue)

From: Patrick Garies <pgaries@fastmail.us>
Date: Tue, 22 Dec 2009 03:30:01 -0600
Message-ID: <4B309199.9060200@fastmail.us>
To: Garrett Smith <dhtmlkitchen@gmail.com>
CC: Travis Leithead <travil@microsoft.com>, www-style <www-style@w3.org>
On 9/22/2009 8:08 PM, Garrett Smith wrote:
>> I also assume that getStyleAs can return a plethora of possible values from strings to other interfaces...
>>
>
> I was thinking it would return a string although |asNumber| param
> might a possibility:-
>
> x.getStyleAs("length", "px", "number");
>
> Returns a number representing the length, in css pixels.

For some reason, I'm thinking Travis was wondering what all the types of 
returnable values are. So far, pixels, integers, and RGBA seem to be 
covered based upon your examples. |rgb| is also mentioned, but it's not 
clear if that's a reference to the hexadecimal or functional notation.

The above code also seems overly complex IMHO. I can't tell what 
|"length"| is for. |x.getStyleAs("pxint")| or |x.getStyleAs("px", 
"int")| seem simpler; both output a pixel value as an integer. (I assume 
|x| is a reference to something like |element.style.margin| or am I 
mistaken?)
Received on Tuesday, 22 December 2009 09:30:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:47:12 GMT