[whatwg] New method for obtaining a CSS property

"Boris Zbarsky" <bzbarsky at MIT.EDU> wrote:

>On 1/27/11 4:48 AM, Brett Zamir wrote:
>> I was thinking of it grabbing the "winning" property for the whole
>> document, i.e., the one which would be applicable without knowing
>more
>> contextual information. So, if the selector specified were ".error",
>it
>> wouldn't get "div.error"
>
>That's pretty difficult to define, actually.  Should it get
>".error.error"?
>
>> Whatever the rules, it would be the team's responsibility to ensure
>it
>> was unique enough to provide the right value (as it is within CSS
>itself
>> via cascading).
>
>Why is just asking for computed style, and getting correct answers that
>
>include the results of the cascade, not the right solution here?
>
>-Boris


Without context you can't get the cascading or "winning" values for css attributes. You could create a whole pseudo document to get this, but it is needlessly complex. You say you would want .error to not get matched by div.error, but in a real document the order of the styles and the weight of them (id's over classes, !important rules, etc) dictate the final style attributes.


Thanks
Ash
http://www.ashleysheridan.co.uk
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Received on Thursday, 27 January 2011 10:42:40 UTC