class Gammo::XPath::AST::Axis::Following

Public Instance Methods

each_following(context_node) { |node| ... } click to toggle source
# File lib/gammo/xpath/ast/axis.rb, line 144
def each_following(context_node)
  stack = [context_node]
  until stack.empty?
    node = stack.pop
    yield node unless node == context_node
    stack << node.next_sibling if node.next_sibling
    stack << node.first_child if node.first_child
  end
end
strain(context, context_node, node_set) click to toggle source
# File lib/gammo/xpath/ast/axis.rb, line 134
def strain(context, context_node, node_set)
  context_node = context_node.owner_element if context_node.instance_of?(Gammo::Attribute)
  while node = context_node.next_sibling
    each_following(node) do |node|
      node_set << node if node_test.match?(node)
    end
    break if context_node.parent.tag != Gammo::Tags::Html
  end
end