W3C home > Mailing lists > Public > www-style@w3.org > October 2011

Re: Selecting the parent of an element

From: Barry van Oudtshoorn <bvanoudtshoorn@gmail.com>
Date: Fri, 7 Oct 2011 11:05:27 +0800
Message-ID: <CAFsVuTN83VzkzHVH1uuMNO_Fvp_mgeUOp6ZEsbqP5_jsmFZQbA@mail.gmail.com>
To: www-style@w3.org
On Fri, Oct 7, 2011 at 6:57 AM, fantasai <fantasai.lists@inkedblade.net>wrote:

> On 10/06/2011 01:53 AM, Barry van Oudtshoorn wrote:
>> 1. This breaks the natural reading order of CSS selectors: the right-most
>> "part" of a selector no longer identifies the
>> element to which the rules should be applied.
> Your reversed-combinator suggestion has the problem that the selector chain
> no longer proceeds forwards through the element tree.
> I personally find that more disorienting.

Hmm, I guess it's a matter of personal opinion, then. To my mind, the
purpose of both proposals is to lift the restriction that the selector chain
progresses forwards through the tree. Personally, I find reversed
combinators no more disorienting than, for example, the '../' syntax used in
XPath and file systems. (See the XPath recommendation -- particulary the
section on axes -- for details. [1])

Whichever syntax is implemented, it's likely that at some point, in order to
actually apply the rules, the element tree will be traversed backwards. I
guess that the question boils down to how explicit that reversal should
actually be.

[1] http://www.w3.org/TR/xpath/#axes

>  2. It provides a very specific solution to a very specific problem, rather
>> than a generic, extensible solution. Using this
>> syntax, how would one, for example, identify a preceding direct sibling of
>> an element E?
> $* + E
> It has the same structure as * + E, except instead of the E you pick the *
> as the subject.

That makes sense. I guess I should've thought through that example a bit
more -- I should've been able to come up with that!

The question of what symbol to use is still open; someone suggested ? so the
> latest
> editor's draft is using that since there were objections to $.

Hmm... I think that I dislike the question mark more than the dollar sign,
as it implies some form of conditionality or optionality. I would suggest
that the exclamation mark be used in its place -- as far as I'm aware, it's
only used in '!important'.

Barry van Oudtshoorn
Received on Friday, 7 October 2011 03:06:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:05 UTC