Support for the XPath comment() test.

This commit is contained in:
Yorick Peterse committed 2014-08-15 20:49:13 +02:00
1 parent 4e8cca258c
commit ccd95d69d8
2 files changed
+59

No files matched your search

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