Re: getComputedStyle vs. getCascadedStyle

"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 UTC