W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

Re: getComputedStyle vs. getCascadedStyle

From: Philippe Le Hegaret <plh@w3.org>
Date: Fri, 14 Jul 2000 15:33:26 -0400
Message-ID: <396F6B06.405EB4A6@w3.org>
To: "L. David Baron" <dbaron@fas.harvard.edu>
CC: www-dom@w3.org
"L. David Baron" wrote:
> This proposal for getCascadedStyle is, I think, more similar to IE5's
> currentStyle property [3] than getComputedStyle is.  It would allow the
> retrieval of the cascaded style for an element, which is often what the
> user wants (or, if it is "inherit", it could be figured out for some
> properties by walking up the tree until a non-inherit value is found):

If the value is inherited, you use the computed value of the parent so
you will need the computed style in any case.

>   Interface DocumentCSS
>   Method getCascadedStyle
>   Parameters:
>     Element elt  [ same as getComputedStyle [1] ]
>     DOMString pseudoElt  [ same as getComputedStyle [1] ]
>   Return Value:
>     CSSStyleDeclaration  The cascaded style for the element.  The
>       CSSStyleDeclaration is read-only, and contains the cascaded
>       values for the element.  If no rule matching the element and
>       pseudo-element contains a declaration for a property, the value
>       for that property should be the default value of that property
>       (if it is not inherited) or the value "inherit".

This is not what is implemented in the currentStyle property of IE.

<style type='text/css'>
p { color: rgb(50%, 50%, 50%); }
</style>
<body>
  <p>Bla<em>bla</em></p>
</body>

p.currentStyle.color and em.currentStyle.color return rgb(127, 127, 127)

I agree that this proposal is useful but it needs more clarifications.
Your proposal seems a new idea even for the existing browsers ...

Philippe
Received on Friday, 14 July 2000 15:33:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT