Support for the XPath text() type test.

This commit is contained in:
Yorick Peterse committed 2014-08-15 10:46:00 +02:00
1 parent 14aa420091
commit 4d7f224892
3 files changed
+60 -1

No files matched your search

+17
View File
@@ -457,6 +457,23 @@ module Oga
return nodes
end
##
# Processes the `text()` type test. This matches only text nodes.
#
# @param [Oga::XPath::Node] ast_node
# @param [Oga::XML::NodeSet] context
# @return [Oga::XML::NodeSet]
#
def on_type_test_text(ast_node, context)
nodes = XML::NodeSet.new
context.each do |node|
nodes << node if node.is_a?(XML::Text)
end
return nodes
end
##
# Returns a node set containing all the child nodes of the given set of
# nodes.