W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: element existence selector

From: Peter Krauss <ppkrauss@gmail.com>
Date: Fri, 27 Feb 2015 12:29:55 -0300
Message-ID: <CAHEREtuvGirQd6GiNOcnwNd8PmouskZ7D+QfwhyCJ5HhoiFK_A@mail.gmail.com>
To: Brian Kardell <bkardell@gmail.com>
Cc: "www-style@w3.org" <www-style@w3.org>
Yes, perhaps the best explanation is a concrete example, see

    https://jsfiddle.net/xkjb1jao/

A direct answer to your question: the "*e1 e2*" selector only works if *e2*
is into *e2*,
the existence operator will captures the another *more general *cases.


2015-02-27 12:08 GMT-03:00 Brian Kardell <bkardell@gmail.com>:

>
>
> On Fri, Feb 27, 2015 at 9:37 AM, Peter Krauss <ppkrauss@gmail.com> wrote:
>
>> Since CSS2 we can express the "existence of attributes",
>>
>>    http://www.w3.org/TR/WD-CSS2/selector.html#h-5.7.1
>>
>> with the *[att]* selector,
>>
>> *    element[att] {do}*
>>
>> and it is easy implement this kind of conditional selector in CSS
>> parsers...
>>
>> The suggestion (or question) here is about use *the same ideia with
>> elements*, a kind of existence operator,
>>
>> *    e1 <existenceOperator> e2 {do}*
>>
>> to say "if element *e1* exists, selects the *e2* element".
>>
>>
>> * if it is a new suggestion, can I discuss here this subject?
>>
>> * if there are *some old discussion about it*, sorry, can somebody reply
>> with a link?
>>
>> ------
>> PS: I think that this kind of <*existenceOperator> *can used in a big
>> subset of (imagined) applications of the problematic
>> previous-sibling-selector, and also used as a "*trigger*" in event
>> selectors, like
>>       e1:hover <*existenceOperator*> e2 {do}
>>
>>
>>
>
> Can you explain how is that not just
>
>  e1 e2 {...}
>
> ?  If there is no e1, the e2 won't match.  If there is, it will.
>
>
> --
> Brian Kardell :: @briankardell :: hitchjs.com
>
Received on Friday, 27 February 2015 15:30:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC