Fix 216_test_nested_sibling_extend and 217_test_parent_and_sibling_extend. trim was allowing extra duplicate selectors to come through. The main issue was that the ruby code used Array.equal, which was checking if the selectors were the exact same object. This worked because they did a shallow copy of the array, which kept the same objects in both. When porting this, we did a deep comparison of the array, which gave different results. We clone our equivalent of the array, so we can't see if the objects are the same objects. However, we can just keep track of iteration indices and compare them to skip comparing an object against itself.