Yes. You are right. However, the lack of my misinterpretation of the
spec makes support of the universal selector "*", which NGLayout does
not support, even more important for proper cascading (e.g., for
setting background color or text color so that a user style sheet that
gives a different color to bold elements or to DTs is ignored).
David Baron
--------------------------------------------------------------------
L. David Baron | Freshman, Harvard
dba...@fas.harvard.edu | < http://www.fas.harvard.edu/~dbaron/ >
Webmaster, International Weather Satellite Imagery Center, etc.
--------------------------------------------------------------------
"L. David Baron" wrote:
> >From: Peter Linss <pet...@netscape.com>
> >As far as I can tell NGLayout is correctly interpreting the CSS rules in
> >this case.
>
> Yes. You are right. However, the lack of my misinterpretation of the
> spec makes support of the universal selector "*", which NGLayout does
> not support, even more important for proper cascading
Can you point us to the section of the CSS spec that covers the universal
selector you mention? Perhaps you could then also file this as a bug in
bugzilla. Thanks,
-angus
I filed it as bug #850. The relevant sections of the spec (also listed
in the bug) are:
http://www.w3.org/TR/REC-CSS2/selector.html#universal-selector
http://www.w3.org/TR/REC-CSS2/cascade.html#specificity
David
If I understand you correctly, I believe you are mistaken. Used by itself,
the universal selector has a specificity of zero. It will not override
styles in a user style sheet.
Even the author style
* { color: blue !important }
will not override a user style
P { color: red }
The aformentioned author style will, however, override a user style
* { color: lime }
Braden
<http://www.w3.org/TR/REC-CSS2/selector.html#universal-selector>
Braden
I still think I am correct, because the universal selector matches any
element (however, a P rule cannot be overriden by a BODY rule, since
the BODY rule does not match the P even though BODY is P's parent), and
therefore the rules 2, 3, and 4 in
http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order
apply. These three rules for determining priority of declarations are
1) weight and origin:
user !important
author !important
author
user
2) specificity (see http://www.w3.org/TR/REC-CSS2/cascade.html#specificity )
3) order specified
The rule that applies in this case is origin, and therefore the
specificity is irrelevant. If what you said were true, then there
would be no difference between * and BODY.
David Baron
Yes, you are right. My claims for the example I gave were incorrect.
Amended, the author style
* { color: blue !important }
*will* override a user style
P { color: red }
I was not properly applying the 2nd rule.
Braden
Yes, and also the point that I was making in my original post, the author
style
* {color: blue}
will override the user style
P {color: red}
even without the important. Where it will not override is if they are
both author style, but the * rule is specified later.
No... You need the !important declaration there, because user styles
override author styles. Consider an analogous situation, but using classes:
author style:
.foo { color: red }
user style:
P.foo { color: blue }
The user has overridden the color of the "foo" class for P elements. They
will be blue, while other elements with class "foo" will remain red.
Braden
When both are !important, user styles override author styles, but when
both are *not* !important, author styles override user styles.
See http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order
David Baron
Yes, you are right. I'm sorry... I guess I've been staring at this stuff too
long.<g>
Braden
That's why we've been saying "some of css2". We don't have time for all of it.
--
-----------------------------------------------------------------------
Kipp E.B. Hickman
<><
Netscape Communications Corp. http://people.netscape.com/kipp/index.html