Re: Proposal: getStyleAs(property, primitiveValue)

On 12/22/2009 12:58 AM, Garrett Smith wrote:
> A solution that would cover all use-cases:
>
>    style.getValueAs("width", "px")

I like the idea. It would probably get more traction though if you had:

* a list of possible values for both arguments and what properties 
should apply. (Can you use "ch"?)
* an explanation for what is returned on those arguments. (Does the 
above code return an integer or the full string with "px" appended? Does 
"rgb" return integers or percentages and are the |rgb(|, |,|, |,|, and 
|)| parts returned too?)
* an explanation for what is returned when invalid arguments are supplied.
* an explanation for what is returned when the DOM property is used on a 
CSS property with multiple sub-values. (Do you get a value list or a 
single value? What about properties like CSS3 Backgrounds and Border's 
|background-position|; do you get offsets from the top-left or a 
conversion of the original values? How about those with potentially 
mixed values (and no sub-properties) like CSS3 B&B's |border-image-slice|?)
* code for handling pseudo-elements.

Received on Tuesday, 22 December 2009 09:17:25 UTC