-
-
Notifications
You must be signed in to change notification settings - Fork 901
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
last-child, etc, pseudo selectors don't work #354
Comments
Sure we do:
I think the problem here is a misunderstanding of what last-child means in this context. If you use 'dd:last-child', it means "any element who is named dd and is the last child of its parent.". If you use 'dd.foo:last-child', it means "any element who is named dd and has the class 'foo' and is the last child of its parent. Your gist doesn't contain such an element, and so returns nothing. If you change the html in your gist to be:
(note: the last DD now has class 'foo') you'll see that Nokogiri returns the correct element. In the future, questions like this about CSS are better sent to the mailing list, so that people with similar questions might be able to more easily share in our conversation. Thanks for using nokogiri! |
Changing the class of the last dd to "foo" doesn't help, its not the one that I want to find. I'm trying to find the last dd having class foo. I understand what you're saying about |
Ah, OK, then that's a bug in nth-last-child, not a bug in last-child. I'll isolate where the problem is and will update this ticket. (Reopening) |
fixing off-by-one with nth-last-child and nth-last-of-type CSS selectors when NOT using an+b notation. closed by bb3cab9. |
Example in this Gist, http://gist.github.com/639600, I'm trying to select the last DD having a certain class.
The
nth-last-child(1)
selector works, butlast-child
does not. Does nokogiri not implement thelast-foo
selectors?The text was updated successfully, but these errors were encountered: