- From: Francois Remy <fremycompany_pub@yahoo.fr>
- Date: Sun, 13 Jul 2008 22:11:54 +0200
- To: "L. David Baron" <dbaron@dbaron.org>, "Garrett Smith" <dhtmlkitchen@gmail.com>
- Cc: "CSS 3 W3C Group" <www-style@w3.org>
> On Saturday 2008-07-12 16:06 -0700, Garrett Smith wrote:
>> >> 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.
>> >
>>
>> You lost me on that one. What was it you were trying to explain?
>
> I was saying it might be worth having two different APIs. Let's
> call them (for purposes of this example; I think these are bad
> names) element.authorSpecifiedStyle and element.allSpecifiedStyle.
If we want to preserve compatibility with IE's names (that exists sinds
1998), we need :
- currentStyle (all existing rules. If no value, then return the default
value. If default value is inherit, compute the value of the parent)
- authorStyle (only rules defined in author's stylesheets. If no value, then
return null)
> An example to show the difference between the two: if the UA style
> sheet has:
> h1 { font-weight: bold; font-size: 200%; }
> and the page's style sheet has:
> h1 { text-decoration: underline; }
> then:
> element.authorSpecifiedStyle.textDecoration == "underline"
> element.allSpecifiedStyle.textDecoration == "underline"
> element.authorSpecifiedStyle.fontWeight == ""
> element.allSpecifiedStyle.fontWeight == "bold"
So we can get :
(ua-css) h1 { font-size: 200%; font-weight: bold; }
(ath-css) div.a { font-size: 15px; }
(ath-css) div.a > h1 { text-decoration: underline; }
(ath-css) <div class="a"><h1 style="color: darkblue;">Some title</h1></div>
h1.[style].fontSize:
- style : ""
- authorStyle : null
- currentStyle : "200%"
- computedStyle : "30px"
h1.[style].fontWeight:
- style : ""
- authorStyle : null
- currentStyle : "bold"
- computedStyle : "bold"
h1.[style].textDecoration:
- style : ""
- authorStyle : "underline"
- currentStyle : "underline"
- computedStyle : "underline"
h1.[style].color:
- style : "darkblue"
- authorStyle : "darkblue"
- currentStyle : "darkblue"
- computedStyle : "#rrggbb"
Right ?
Regards,
Fremy
>
> -David
>
> --
> L. David Baron http://dbaron.org/
> Mozilla Corporation http://www.mozilla.com/
>
Received on Sunday, 13 July 2008 20:12:37 UTC