Re: Proposal: getStyleAs(property, primitiveValue)

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 UTC