Re: [css-selectors] descentant up to a certain depth

Ok, that reduces the duplication a bit, but still requires elem1 and elem2
to be named explicitly twice. Which is not convenient when elem1 and elem2
are complex selectors.

I was thinking of the possibility to pass parameters to the descendant
combinator.
For example:

elem1 >(3)> elem2  /*descendants up to third level*/
elem1 >(2,5)> elem2  /*descendants from second to fifth level*/
elem1 >(1)> elem2  /*same as child combinator*/

How do you like it?



On Sun, Jul 3, 2016 at 12:03 PM, Brad Kemper <brad.kemper@gmail.com> wrote:

>
> > On Jul 2, 2016, at 7:51 PM, Hr Gwea <hrg.wea@gmail.com> wrote:
> >
> > Is there any plans or ideas to simplify selectors like this:
> >
> > elem1 > elem2,
> > elem1 > * > elem2,
> > elem1 > * > * > elem2 {...properties...}
> >
> > i.e. all elem2 that are children, grandchildren or great-grandchildren
> of elem1.
> > More generally, a descendant combinator that let us specify the max
> depth of the descendants
>
> In selectors 4, :not() can take a selector list.
>
> elem1 elem2:not(elem1 * * * elem2) {
>   /* should do what you want */
> }
>
> > If not, can I propose a solution?
>
> You can always propose.

Received on Sunday, 3 July 2016 20:28:33 UTC