Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CSS Cascading Bug in NGLayout

22 views
Skip to first unread message

L. David Baron

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to mozilla...@mozilla.org, pet...@netscape.com
>From: Peter Linss <pet...@netscape.com>
>As far as I can tell NGLayout is correctly interpreting the CSS rules in
>this case.
[details of discussion of cascading from a few weeks ago clipped]

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.
--------------------------------------------------------------------


Angus Davis

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to L. David Baron

"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


L. David Baron

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to an...@netscape.com, mozilla...@mozilla.org
>From: Angus Davis <an...@netscape.com>

>"L. David Baron" wrote:
>>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

Braden N. McDaniel

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to
L. David Baron wrote in message
<1998092000...@login1.fas.harvard.edu>...

>>From: Peter Linss <pet...@netscape.com>
>>As far as I can tell NGLayout is correctly interpreting the CSS rules in
>>this case.
>[details of discussion of cascading from a few weeks ago clipped]
>
>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).

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

Braden N. McDaniel

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to
Angus Davis wrote in message <3604ADC0...@netscape.com>...

>Can you point us to the section of the CSS spec that covers the universal
>selector you mention?

<http://www.w3.org/TR/REC-CSS2/selector.html#universal-selector>

Braden

L. David Baron

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to bra...@shadow.net, mozilla...@mozilla.org
>From: "Braden N. McDaniel" <bra...@shadow.net>

>L. David Baron wrote in message
><1998092000...@login1.fas.harvard.edu>...
>>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).
>
>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 }

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


Braden N. McDaniel

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to
L. David Baron wrote in message
<1998092022...@login5.fas.harvard.edu>...

>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


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

L. David Baron

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to bra...@shadow.net, mozilla...@mozilla.org
>From: "Braden N. McDaniel" <bra...@shadow.net>
>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.

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.

Braden N. McDaniel

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to
L. David Baron wrote in message
<1998092023...@login4.fas.harvard.edu>...

>>From: "Braden N. McDaniel" <bra...@shadow.net>
>>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.
>
>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

<http://www.endoframe.com>

L. David Baron

unread,
Sep 21, 1998, 3:00:00 AM9/21/98
to bra...@shadow.net, mozilla...@mozilla.org
>From: "Braden N. McDaniel" <bra...@shadow.net>
>No... You need the !important declaration there, because user styles
>override author styles. Consider an analogous situation, but using classes:

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

Braden N. McDaniel

unread,
Sep 21, 1998, 3:00:00 AM9/21/98
to
L. David Baron wrote in message
<1998092101...@login4.fas.harvard.edu>...

>>From: "Braden N. McDaniel" <bra...@shadow.net>
>>No... You need the !important declaration there, because user styles
>>override author styles. Consider an analogous situation, but using
classes:
>
>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


Yes, you are right. I'm sorry... I guess I've been staring at this stuff too
long.<g>

Braden

<http://www.endoframe.com>

Kipp E.B. Hickman

unread,
Sep 21, 1998, 3:00:00 AM9/21/98
to
The "*" selector is an example of CSS2 that we are not currently planning on supporting. Of course, if some netizens help us write some code, we'll be glad to support it.

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
 

0 new messages