W3C home > Mailing lists > Public > www-style@w3.org > December 1999

Re: Why no Parent Selector?

From: Daniel Glazman <Daniel.Glazman@der.edfgdf.fr>
Date: Wed, 1 Dec 1999 12:34:51 +0100 (MET)
Message-Id: <199912011134.MAA25049@cli51ak.der.edf.fr>
To: www-style@w3.org
Cc: Daniel.Glazman@der.edf.fr, dwagner@kevric.com

> I have a few concerns about the :subject selector.
> Is it really a pseudo-class?
> The draft spec suggests that it is, however that makes no sense. The
> idea behind pseudo-classes is to have an effect similar to using the
> class selector (.xxx) -- i.e., an element matches if and only if that
> element matches a certain condition (e.g., cursor is above it, it is
> the first element of its type amongst its siblings, one of its
> attributes has a certain value, etc...). However, the :subject
> selector _always_ applies -- in fact, it has no relevance whatsoever
> to matching the document tree, it merely changes the resulting meaning
> of the complete selector.

You are right. It is not IMHO opinion a pseudo-class. It only has to
deal with CSS parsing of selectors. And that's why the original
version of STTS3 was using a completely different syntax : the subject
of the selector was indicated by a leading descriptor "!". For

	!P > DEL

instead of

	P:subject > DEL

Thank you, Ian, for that very important and helpful comment. Like all
you comments in this mailing-list...

> (So maybe it is a pseudo-element? Again no. A pseudo-element matches
> something that is not in the document tree, but :subject doesn't
> particularly 'match' anything. [1])


> However, even given that it is not a pseudo-class and that presumably
> it could therefore have some other syntax, it is still Wrong: as a
> _selector_, it should be selecting something -- but as mentioned
> above, :subject does not match anything, it merely changes the
> eventual interpretation of the selector chain.

Agreed. That's why I used the "descriptor" word in STTS original

> Another problem is that [presumably?] :subject does not act like any
> other CSS selector syntax -- it is allowed anywhere, but only once per
> selector. (Effectively it has [AFAICT] opposite restrictions to
> pseudo-elements.) If this is relaxed and used to allow brevity in
> selectors, then this would be of limited use as it would break
> backwards compatability, and so any rules using those selectors would
> have uncertain effects on legacy browsers [2].

I can't get your point here. Can you explain that ?

> Further, it reverses the established convention that selectors match
> the simple selector element in a selector chain.

Yes, so what ? Not a problem at all.

> Finally, it is not very versatile -- it is somewhat limited to acting
> as a parent selector and as an inverse sibling selector, for which
> much simpler syntaxes could be used, namely combinators such as "<"
> and "-", and so on.

"-" cannot be used for parsing reasons. Anyway, I don't think that
using a special combinator is a good idea.

> I would propose (again) that instead of :subject, we introduce a
> function-like pseudo-class which matches an element if its argument,
> treated as the rest of the selector, match. [3]
> [ lot of interesting proposals ]

Ian, this approach is interesting but complex. CSS has a great thing
that I really (personal opinion) don't want to break : human
readability. I think that your proposal reduces a lot readability.
I'll leave browser vendors express their opinions but I also think
there are implementation (parsing) concerns (data between parenthesis
are not a selector, just a part of selector).

Received on Wednesday, 1 December 1999 06:34:57 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:52 UTC