tenderlove/nokogiri — Issue #596: CSS selector: cannot get nth child
Author: schmurfy
Created: 2012-01-11 09:25:23+00:00
State: open

Hi,
I have problems making nth-child working, here is my example:

```ruby
gem 'nokogiri', '~> 1.5.0'
require 'nokogiri'

html = Nokogiri::HTML <<-EOS

first content

second content

EOS

html.css('td.forum_thread_post:nth-child(1)').each do |node|
puts ""
puts node.to_s
end

# result:
#
#
# first content
#
#
#
# second content
#
```

I tried with a simple html and it worked but with the example above it always returns all matching nodes, I tried with ":nth", ":nth-child", ":first-child", "last-child", none worked :/