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

Re: Should IE drop currentStyle/ runtimeStyle?

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Wed, 23 Sep 2009 14:28:52 -0700
Message-ID: <c9e12660909231428x71d57ec8g3c43019f49677194@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: Travis Leithead <travil@microsoft.com>, www-style CSS <www-style@w3.org>, Sylvain Galineau <sylvaing@microsoft.com>, Sharon Cohen <sharco@microsoft.com>
On Tue, Sep 22, 2009 at 5:23 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 9/22/09 3:21 PM, Travis Leithead wrote:
>> This makes it seem like developers just want "some" value for a style, but
>> aren't looking specifically for a computed/cascaded value. That's actually
>> what I want to discover--is this true? Are there specific needs to get both
>> the computed value and the cascaded style? Or do developer care?
> So in practice, when people get the "computed" style for some properties
> (width, especially) via getComputedStyle they actually expect something
> closer to "used" style (or CSS2 computed style, which is different from
> CSS2.1 computed style).
> We (Gecko) have heard a number of requests or a getCascadedStyle or
> equivalent.  I think it would be worth agreeing on an API for that and
> implementing.

If you can nail down some usage patterns first.

The method should not exist on document.defaultView if IE is going to adopt it.

If IE9 implementing a - document.defaultView - would break sites that
make inferences of document.defaultView being not Internet Explorer.
IE implementing document.defaultView would necessitate an "opt in"
mode, to avoid widespread breakage.

The proposal of getCascadedStyle would cause much less damage by
putting the method directly on window, and not exposing it to

However, the method getCascadedStyle does not pertain to the window as
much as it pertains to the element whose cascaded style is of concern.


But this still brings about the issue of "auto" and "inherit". When a
program encounters those values, it can either be redesigned to have
actual values or it can do the heavy lifting in the script, following
the rules in CSS to either findAncestorWithStyle,  isShrinkToFit,
getContainingBlock. This is messy, cumbersome, slow, error prone, and
only works when the program calculates the CSS rules in the same way
the browser did.

That could be avoided with:-

element.getStyleAs("width", "px")

> As for computed vs used style, I'm not quite sure what authors want there
> (or even whether most of them understand the difference).

It would be best to nail down the problems and their contexts.

Received on Wednesday, 23 September 2009 21:29:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:39 UTC