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

:eq css selector should index from zero #652

Open
mattheworiordan opened this issue Apr 6, 2012 · 3 comments
Open

:eq css selector should index from zero #652

mattheworiordan opened this issue Apr 6, 2012 · 3 comments
Milestone

Comments

@mattheworiordan
Copy link

I read on https://github.com/tenderlove/nokogiri/wiki/From-jQuery-Traversing about using :eq for traversing and selecting an element using Nokogiri, which is great... untilI discovered that :eq(1) refers to the first element with Nokogiri, and in JQuery it refers to the second element (zero indexed), see http://api.jquery.com/eq/. As I interchangeably use my CSS selectors in client-side Javascript tests and Capybara tests, this is causing endless issues.

I propose that :eq should be compatible with JQuery and use an zero based index.

@mattheworiordan
Copy link
Author

Sorry, I should have added this in for reference, http://stackoverflow.com/questions/4124523/what-library-does-capybara-use-as-css-selector. I have seen a few mentions online of people experiencing the same surprise.

@flavorjones
Copy link
Member

See https://github.com/tenderlove/nokogiri/issues/628 for related bug report.

Because this sort of change can break lots of things in bad ways, we're planning on addressing JQuery compatibility in 2.0. You can read more about the roadmap here: https://github.com/tenderlove/nokogiri/blob/master/ROADMAP.md

I'll add this issue to the roadmap.

@mattheworiordan
Copy link
Author

Thanks for the reply, makes sense to make this part of a bigger update as you're right, it could certainly break things.

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

2 participants