W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: [CSSOM] Can we have a .computedStyle in ElementCSSInlineStyle

From: Francois Remy <fremycompany_pub@yahoo.fr>
Date: Sun, 13 Jul 2008 00:15:11 +0200
Message-ID: <05E6F2B86E544D7BBDB3FBF92DD8913E@FremyCompany1>
To: "L. David Baron" <dbaron@dbaron.org>, "CSS 3 W3C Group" <www-style@w3.org>

> I'm not sure I follow exactly what you'd want in runtimeStyle or
> currentStyle (or what the difference is).

runtimeStyle is a IE-extension that have been added to the Opera's working 
draft about CSSOM.
I think it's now obsolete but I agree to explain you what it is, in fact.

consider the following :
    div { display: inline; } <div style="display: none" 
onload="this.runtimeStyle.display='block'" />

Runtime style is a "style" attribute that overrides any other rules in the 
document (except with !important) and which is only available by script.
So the DIV will be displayed as block, but div.style.display will continue 
to say "inline" (div.runtimeStyle.display will be "block", same for the 
readonly currentStyle).

But I'm not sure it's really needed. I juste wrotten the runtimeStyle here 
because it's already a part of the draf.

> However, I'd note that there may be value in two different forms of
> specified style:
>
> * a CSSStyleDeclaration that has all properties specified in author
>   style sheets
>
> * a CSSStyleDeclaration that has all properties specified at all
>   levels of the cascade
>
> I think the first of these would be preferable for editing-type
> tasks (manipulating markup intended to be used later).  The second
> would be a little more like getComputedStyle.

Consider the following :
    div { font-size: 200% }  <div><span style="font-size: 
50%">...</span></div>

currentStyle :
    - on the div : 200%
    - on the span : 50%

computedStyle :
    - on the div : 2Fpx
    - on the span : Fpx

> In both cases, it would have no value for properties that aren't
> specified.  (This is different from computed style, which always has
> a value.)

currentStyle should take in count the default/inherited values of property.
    document.body.currentStyle.fontSize should return "12pt" if it's the 
user setting.

computedStyle should be only the conversion in standardised units of 
currentStyle

>
> (Something else that might be interesting, although I'm not sure if
> it would be particularly useful for Web authors, is a way of getting
> all the author style rules that match an element.  The DOM Inspector
> extension to Firefox shows this information; I'm not sure if it
> would be useful from script.)

Really interesting !
Currently, we must look at each rule and try parsing them (or in new 
browsers, use querySelectorAll and see if the element is in the list).

What about a IHTMLElement.appliedRules as DOMCollection(Of CSSRule) ?

> -David
>
> -- 
> L. David Baron                                 http://dbaron.org/
> Mozilla Corporation                       http://www.mozilla.com/
> 
Received on Saturday, 12 July 2008 22:15:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT