code: function walk(node, rootNode, prev) {
        var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';
  
        // Walk into nodes if it has a start
        if (node[startName]) {
          return node[startName];
        }
  
        // Return the sibling if it has one
        if (node !== rootNode) {
          sibling = node[siblingName];
  
          if (sibling) {
            return sibling;
          }
  
          // Walk up the parents to look for siblings
          for (parent = node.parent; parent && parent !== rootNode; parent = parent.parent) {
            sibling = parent[siblingName];
  
            if (sibling) {
              return sibling;
            }
          }
        }
      }
docs: Walks the tree left/right