more efficient preorder DOM traversals