再帰
function TreeWalker(root){ this.root = root; this.walk = function(func){ (function(node){ if(node.nodeType != 1){return} func.apply(node); var ch = node.childNodes; var len = ch.length; (function(i,fn){ if(len <= i){return} fn(ch[i]); argu…
function TreeWalker(root){ this.root = root; this.walk = function(func){ (function(node){ if(node.nodeType != 1){return} func.apply(node); var ch = node.childNodes; var len = ch.length; (function(i,fn){ if(len <= i){return} fn(ch[i]); argu…