public Method

Selector.next_element(element, name = nil)

Return the next element after this one. Skips sibling text nodes.

With the name argument, returns the next element with that name, skipping other sibling elements.

Source Code

# File action_controller/vendor/html-scanner/html/selector.rb, line 493
def next_element(element, name = nil)
  if siblings = element.parent.children
    found = false
    siblings.each do |node|
      if node.equal?(element)
        found = true
      elsif found && node.tag?
        return node if (name.nil? || node.name == name)
      end
    end
  end
  nil
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.