Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nth descendant #84

Closed
Mouvedia opened this issue Nov 15, 2012 · 4 comments
Closed

nth descendant #84

Mouvedia opened this issue Nov 15, 2012 · 4 comments

Comments

@Mouvedia
Copy link
Member

We need something like :nth-descendant.

<root>
 <a />
 <b />
 <c>
   <x>
     <d>
        <y />
     </d>
   </x>
 </c>
 <d />
</root>
First proposal

The level filter.

Second proposal

A functional notation for the descendant combinator.

//selects the d elements descendants of root nested 3 levels deep
root ..(3) d { }
//selects the y elements descendants of c nested 3 levels deep
root c ..(3) y { }
//selects the y elements descendants of c nested 3 levels deep or more
root c ..(≥3) y { }
Third proposal

A modifier which repeats the selector.

root container 3[*] element { }
//would be equivalent to
root container * * * element { }
@FSX
Copy link

FSX commented Nov 16, 2012

I would go for :lvl(N), because it looks like the element must be at level N. And ..(N) looks like all the elements starting from level N are selected.

@jakepetroules
Copy link
Contributor

:lvl(N)

@Mouvedia
Copy link
Member Author

@FSX very good point: a functional notation on the combinator alter the way the combinator works hence it could be interpreted as from this level or till this level instead.

I updated the example to cover these cases. On @veosotano's feedback, I removed the first proposal on the grounds that a filter needs to be global: this one can't be used with another combinator preceding the element.

I have also added a third proposal which covers the main use case.

@Mouvedia
Copy link
Member Author

superseded by #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants