class Gammo::XPath::AST::Axis::AncestorOrSelf

Public Instance Methods

strain(context, context_node, node_set) click to toggle source
# File lib/gammo/xpath/ast/axis.rb, line 58
def strain(context, context_node, node_set)
  node_set << context_node if node_test.match?(context_node)
  if context_node.instance_of?(Gammo::Attribute)
    context_node = context_node.owner_element
    node_set << context_node if node_test.match?(context_node)
  end
  node = context_node
  while node = node.parent
    node_set << node if node_test.match?(node)
  end
end