W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: Previous-sibling combinator

From: Greg Houston <gregory.houston@gmail.com>
Date: Thu, 16 Aug 2012 23:54:48 -0500
Message-ID: <CAOtq01D0-2BpyGz82pVM45oY6ndBDZKRdRz6ThMFGH2BcpgU7Q@mail.gmail.com>
To: "Kang-Hao (Kenny) Lu" <kanghaol@oupeng.com>
Cc: "Marat Tanalin | tanalin.com" <mtanalin@yandex.ru>, WWW Style <www-style@w3.org>
On Thu, Aug 16, 2012 at 10:52 PM, Kang-Hao (Kenny) Lu
<kanghaol@oupeng.com> wrote:
> (12/01/28 7:05), Marat Tanalin | tanalin.com wrote:
>> The "-" combinator is functionally similar to existing "+"
>> combinator, but selects previous-sibling element instead of
>> next-sibling one.
>>
>> So in result we would have "+" to move forward, and "-" to move
>> backward (like element.nextSibling and element.previousSibling in
>> DOM, respectively).
>
> While I think this idea makes sense, using "-" would mean that you have
> to put spaces around "-". For example, compare
>
>   x-element {} /* I am not following the Web Compoents work and I don't
>                   know if the x-prefix idea is still there */
>
> to
>
>   x - element {}
>
> .
>
> I have no idea how big this concern is.
>
>
> Cheers,
> Kenny
> --
> Web Specialist, Oupeng Browser, Beijing
> Try Oupeng: http://www.oupeng.com/
>

I think the exclamation point was put in the wrong place. It would be
better to simply reverse a directional selector. Not only is it much
easier to write but it makes a little more sense where we generally
think of the exclamation point as meaning "not", like != (not equal).
Not UL doesn't make binary sense, but !+ (not next) makes a bit more
sense for previous.

:matches(!UL + P) > LI
vs.
P !+ UL > LI

:matches(!UL ~ P) > LI
vs.
P !~ UL > LI

:matches(!UL > P) > LI
vs.
P !> UL > LI

:matches(!UL P) > LI
vs.
P ! UL > LI

Not sure If I am writing this one correctly using nested :matches...
:matches(!panel > :matches(!header > :matches(!.float-right > .btn))) > footer
vs.
.btn !> .float-right !> header !> .panel > footer
Received on Friday, 17 August 2012 04:55:18 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT