f = function(root) {
    for (var i=0;i<root.children.length;i++) {
      callback(root.children[i]);
      f(root.children[i]);
    }
  }
Walks down the element tree with a callback

@function
@param {Function} callback The callback to call on each element