Proper support for the XPath "following" axis.

This commit is contained in:
Yorick Peterse 2014-08-04 18:57:21 +02:00
parent 57fcbbd0fc
commit 211caf00c6
1 changed files with 15 additions and 8 deletions

View File

@ -252,15 +252,22 @@ module Oga
nodes = XML::NodeSet.new nodes = XML::NodeSet.new
context.each do |context_node| context.each do |context_node|
current = context_node check = false
# TODO: implement me properly this time. @document.each_node do |doc_node|
# # Skip child nodes of the current context node, compare all
# Step 1: gather *all* the nodes that come after the current node, # following nodes.
# regardless of their nesting. if doc_node == context_node
# check = true
# Step 2: compare all those nodes with the given test, only return throw :skip_children
# those that match. end
next unless check
if can_match_node?(doc_node) and node_matches?(doc_node, node)
nodes << doc_node
end
end
end end
return nodes return nodes