This method is deprecated or moved on the latest stable version.
The last existing version (v4.1.8) is shown here.
select_first(root)
public
Similar to #select but returns
the first matching element. Returns nil if no element matches the
selector.
# File actionview/lib/action_view/vendor/html-scanner/html/selector.rb, line 473
def select_first(root)
stack = [root]
while node = stack.pop
if node.tag? && subset = match(node, true)
return subset.first if !subset.empty?
elsif children = node.children
stack.concat children.reverse
end
end
nil
end