Walk down a DOM tree and run a callback on each element