Compare nodes in on_path instead of indexes.

This saves some code and effectively does the same thing.
This commit is contained in:
Yorick Peterse 2014-07-12 00:20:19 +02:00
parent 5808ffa7a4
commit d6aec6aa16
1 changed files with 3 additions and 3 deletions

View File

@ -54,12 +54,12 @@ module Oga
end
def on_path(node)
last_index = node.children.length - 1
last_node = node.children[-1]
node.children.each_with_index do |test, index|
node.children.each do |test|
process(test)
if index < last_index and !@stack.empty?
if test != last_node and !@stack.empty?
swap_context
end
end