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

:has pseudo class isn't working #739

Closed
rogal111 opened this issue Aug 1, 2012 · 1 comment
Closed

:has pseudo class isn't working #739

rogal111 opened this issue Aug 1, 2012 · 1 comment

Comments

@rogal111
Copy link

rogal111 commented Aug 1, 2012

:has selector doesn't work (but I found tests in code for this?):

Example queries:

doc.css('li:has(span.string:not(:empty))>h1>a')
doc.css('li:has(span)>h1>a')
doc.css('li:has(span)')

I temporarily solved this with custom has pseudo class:

class MyCustomSelectors
  def custom_has node_set, selector
      node_set.find_all { |node| node.css(selector).present? }
  end
end

#usage:
doc.css('li:custom_has(span.string:not(:empty))>h1>a',MyCustomSelectors.new)
@flavorjones
Copy link
Member

This is a duplicate of #350.

Better jQuery selector support is on the roadmap for 2.0. See https://github.com/tenderlove/nokogiri/blob/master/ROADMAP.md for more details.

Please note that issue #350 has no failing tests. Providing failing tests on that ticket (hints are provided) would be helpful, if this is important to you.

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

No branches or pull requests

2 participants