Basic boilerplate for descendant-or-self.
This commit is contained in:
parent
766b35d9ce
commit
1916799fef
|
@ -218,7 +218,7 @@ module Oga
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Evaluator the `descendant` axis. This method processes child nodes until
|
# Evaluates the `descendant` axis. This method processes child nodes until
|
||||||
# the very end of the tree, no "short-circuiting" mechanism is used.
|
# the very end of the tree, no "short-circuiting" mechanism is used.
|
||||||
#
|
#
|
||||||
# @param [Oga::XPath::Node] node
|
# @param [Oga::XPath::Node] node
|
||||||
|
@ -226,6 +226,24 @@ module Oga
|
||||||
# @return [Oga::XML::NodeSet]
|
# @return [Oga::XML::NodeSet]
|
||||||
#
|
#
|
||||||
def on_axis_descendant(node, context)
|
def on_axis_descendant(node, context)
|
||||||
|
nodes = XML::NodeSet.new
|
||||||
|
children = child_nodes(context)
|
||||||
|
|
||||||
|
unless children.empty?
|
||||||
|
nodes += on_axis_descendant(node, children)
|
||||||
|
end
|
||||||
|
|
||||||
|
return nodes
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Evaluates the `descendant-or-self` axis.
|
||||||
|
#
|
||||||
|
# @param [Oga::XPath::Node] node
|
||||||
|
# @param [Oga::XML::NodeSet] context
|
||||||
|
# @return [Oga::XML::NodeSet]
|
||||||
|
#
|
||||||
|
def on_axis_descendant_or_self(node, context)
|
||||||
nodes = on_test(node, context)
|
nodes = on_test(node, context)
|
||||||
children = child_nodes(context)
|
children = child_nodes(context)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue