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

Add support for nth-child pseudo-selector #64

Closed
joshuataylor opened this issue Aug 24, 2016 · 6 comments · Fixed by #77
Closed

Add support for nth-child pseudo-selector #64

joshuataylor opened this issue Aug 24, 2016 · 6 comments · Fixed by #77
Labels

Comments

@joshuataylor
Copy link

It's really nice to be able to queries like:

table.some-table > tbody > tr:nth-child(1) > td:nth-child(2)

Support for floki would be awesome :)

@philss
Copy link
Owner

philss commented Oct 12, 2016

Thanks for the suggestion, @joshuataylor! I'm working in a refactor that will let this more easier to implement.

@gbmoretti
Copy link

I'm very interested in that feature too.
Can you give us an update about the refactoring? So maybe someone could help you to make this out :)

Thanks!

@philss
Copy link
Owner

philss commented Nov 15, 2016

Hi @gbmoretti! Today I could finish the POC for this refactor. The result is in this diff.

I will try to finish this until the end of this month. Please follow the issue #71 for more details.

@philss philss added the Feature label Nov 15, 2016
@gbmoretti
Copy link

Thank you! I'll take a look on that :)

@philss
Copy link
Owner

philss commented Dec 1, 2016

Just for the record: the refactor was made in the PR #73 and I'm implementing this feature in this new branch: add-nth-child-pseudo-class.

philss added a commit that referenced this issue Dec 28, 2016
This implementation works only with integers and `odd/even` values for
the nth-child pseudo-class selector.
It closes #64.
philss added a commit that referenced this issue Dec 29, 2016
* Tokenize pseudo-classes

It generates tokens based on rules to capture the pseudo-class name and
value.
It is needed to generate the selector containing the pseudo-class.

* Hide auxiliar function - we don't need it to be public

* Be able to parse pseudo classes for Selector

This is needed in order to add search for nodes using some structural
pseudo classes.

* Parsing pseudo-class expressions and odd/even

It parses the special forms of pseudo-class values into Selector.

* Searching for nodes with pseudo-class nth-child selector

This implementation works only with integers and `odd/even` values for
the nth-child pseudo-class selector.
It closes #64.

* Remove public doc from Floki.PseudoClass module

* Fix comment position

* Move "PseudoClass" module to the "namespace" of Selector

Better organize code.
@philss
Copy link
Owner

philss commented Dec 29, 2016

@joshuataylor @gbmoretti I'm sorry for the delay. This feature is now available in the version 0.12.0.

cc @EmilieP @Ali-l @Lucasosf @andrelip @aphillipo @deini @justgage @mischov

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

Successfully merging a pull request may close this issue.

3 participants