More efficient preorder DOM traversals

This also tackles some nearby FIXMEs. `traverse_preorder is used in a LOT of
DOM functions..

r? @pcwalton