URL: http://developer.mozilla.org/en/docs/Whitespace_in_the_DOM
A group of Functions found on Firefox's official website is equivalent to treewalker. With this function, you can easily implement all the functions of traversal API 2 in IE (nextelementsibling, previuselementsibling, firstelementchild, lastelementchild, children) these functions let you find the next sibling, previous sibling, first child, and last child of a given node (element ). what makes them unique is that they safely ignore whitespace nodes so you get the real node you're looking for each time.
function is_all_ws (NOD) {return! (/[^ \ T \ n \ r]/. test (nod. data);} function is_ignorable (NOD) {return (nod. nodetype = 8) | (nod. nodetype = 3) & is_all_ws (NOD);} function node_before (SIB) {While (SIB = SIB. previussibling) {If (! Is_ignorable (SIB) return SIB;} return NULL;} function node_after (SIB) {While (SIB = SIB. nextsibling) {If (! Is_ignorable (SIB) return SIB;} return NULL;} function first_child (PAR) {var res = par. firstchild; while (RES) {If (! Is_ignorable (RES) return res; Res = res. nextsibling;} return NULL;} function last_child (PAR) {var res = par. lastchild; while (RES) {If (! Is_ignorable (RES) return res; Res = res. previussibling;} return NULL ;}