Re: Previous-sibling combinator

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 UTC