Fix incorrect pruning of SC.SelectionSet objects.

forEach was being used, but inside the forEach, items were being removed
from the set.