Wrapped element to search in NodeSet. Changed selectors to selector.
This commit is contained in:
parent
ea5f3ba0e2
commit
77d0333c08
@ -60,12 +60,14 @@ def css_select(*args)
|
||||
raise ArgumentError, "you at least need a selector" if args.empty?
|
||||
|
||||
if args.first.is_a?(String)
|
||||
root, selectors = response_from_page, args.first
|
||||
root, selector = response_from_page, args.first
|
||||
else
|
||||
root, selectors = args.shift, args.first
|
||||
root, selector = args.shift, args.first
|
||||
end
|
||||
|
||||
root.css(selectors)
|
||||
# wrap in NodeSet to avoid this:
|
||||
# <element div>.css('div') => no matches
|
||||
Nokogiri::XML::NodeSet.new(root.document, [root]).css(selector)
|
||||
end
|
||||
|
||||
# An assertion that selects elements and makes one or more equality tests.
|
||||
|
Loading…
Reference in New Issue
Block a user