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

nokogiri's implementation of :first is different than jQuery's. #628

bryanlarsen opened this Issue Mar 3, 2012 · 2 comments


None yet
3 participants
Copy link

bryanlarsen commented Mar 3, 2012

jQuery's :first pseudo-selector implementation always returns only a single match. Nokogiri's implementation makes :first a synonym for :nth-child(1), which returns all elements that are the first child of their parents, which is a decidedly different result.

Since :first isn't part of the CSS standard, neither implementation is "wrong" per se, but I believe that most people would expect Nokogiri and jQuery to return the same results.

I would rather have an error message saying that :first is not supported than have it be different from jQuery.


This comment has been minimized.

Copy link

tenderlove commented Mar 4, 2012

Interesting. I would like to follow jquery, but changing this will definitely be not backwards compatible. Maybe for 2.0? @flavorjones wdyt?


This comment has been minimized.

Copy link

flavorjones commented Mar 4, 2012

Yup, better jQuery selector support is on the roadmap for 2.0. See for more details.

I'll note this issue in the roadmap.

@flavorjones flavorjones added this to the 2.0.0 milestone Jan 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.