method

select

Importance_1
v2.2.1 - Show latest stable - 0 notes - Class: HTML::Selector
select(root) public

Selects and returns an array with all matching elements, beginning with one node and traversing through all children depth-first. Returns an empty array if no match is found.

The root node may be any element in the document, or the document itself.

For example:

  selector = HTML::Selector.new "input[type=text]"
  matches = selector.select(element)
  matches.each do |match|
    puts "Found text field with name #{match.attributes['name']}"
  end
Show source
Register or log in to add new notes.