30845e3d65
The combination of iterating over an array and removing values from it results in not all elements being removed. For example: numbers = [10, 20, 30] numbers.each do |num| numbers.delete(num) end numbers # => [20] As a result of this the NodeSet#remove method uses two iterations: 1. One iteration to retrieve all NodeSet instances to remove nodes from. 2. One iteration to actually remove the nodes. For the second iteration we iterate over the node sets and then over the nodes. This ensures that we always remove all nodes instead of leaving some behind. |
||
---|---|---|
.. | ||
oga | ||
oga.rb |