Re: "Inheriting" from a less-specific selector

----- Original Message -----
From: Ian Hickson <py8ieh@bath.ac.uk>
To: Braden N. McDaniel <braden@endoframe.com>
Cc: <www-style@w3.org>; Bert Bos <Bert.Bos@sophia.inria.fr>
Sent: Wednesday, September 01, 1999 3:29 PM
Subject: Re: "Inheriting" from a less-specific selector


> On Wed, 1 Sep 1999, Braden N. McDaniel wrote:
>
> > > CSS1 has this 'problem' too, and there is no need to invoke pseudo
> > > classes to demonstrate it: this is the whole idea of the cascade.
> > >
> > > For example:
> > >
> > >    P EM { color: red }
> > >    STRONG EM { color: green }
> > >
> > >    <P> <STRONG> <EM> green </EM> </STRONG> </P>
> > >
> > > How can you make an EM in a STRONG be the same color as an EM _not_ in
a
> > > STRONG, without knowing what the colour of an EM not in a strong would
> > > normally be? You can't. (You could override the later rule by using
> > > !important, and you could change the order, but that is 'cheating'.)
> >
> > Ah, right you are. I don't buy, though, that this is the "whole idea of
the
> > cascade."
>
> Ok, not the _whole_ idea, but a major part of it, anyway.
>
> The fact that a later rule 'overrides' an earlier rule of the same weight,
> specificity and origin and matching the same element is an important part
> of it the cascade.
>
> Another, even simpler example:
>
>    P { color: red; color: green; }
>
> The second declaration overrides the first. That is elementary cascadics.

This is different, and I'm not sure you see the problem I'm noting. I can
restore P's color to its initial value with the rule

  P { color: inherit; }

If a default or user style sheet has a rule like

  P:hover { color: blue }

there is *no way* that I can restore P:hover's color to its initial
behavior, which is for P:hover to effectively inherit its color from P. CSS
selectors have no means of representing that kind of inheritance. I think
there should be such a thing.

> > > > For the "cascade" concept to work where the state of the cascade is
not
> > > > known in advance, it is imperitive that style sheet authors always
be
> > > > able to restore the cascade to a defined state.
> > >
> > > Not IMHO. So long as users and UAs write stylesheets that are self-
> > > consistent and responsible (see David's piece, quoted earlier today),
> >
> > Are you suggesting that it is reasonable for context selectors to be
"off
> > limits" for default and user stylesheets?
>
> On the whole, probably. You should ask David, he is more of an expert on
> user stylesheets than I...

Yes... David? I'd be interested to hear your take on this.

> > > there is no need for authors to be totally in control of the cascade.
> > But the fundamental folly of the assumption that browser designers
> > will ensure that they use friendly default stylesheets is soundly
> > demonstrated by the current crop of UA default stylesheets.
>
> I disagree. The problem at the moment is not the UA stylesheets, but the
> CSS engines in the UAs.

I think it's both.

Braden

Received on Wednesday, 1 September 1999 23:44:17 UTC