江户川乱折腾
var Run=Run || {};Run.makestrong= function(hoo, Rx){ if(hoo.data){ var X= document.createElement('strong'); X.style.color= 'red'; // testing only, easier to spot changes var pa= hoo.parentNode; var res, el, tem; var str= hoo.data; while(str && (res= Rx.exec(str))!= null){ var tem= res[1]; el= X.cloneNode(true); el.appendChild(document.createTextNode(tem)); hoo.replaceData(res.index, tem.length,''); hoo= hoo.splitText(res.index); str= hoo.data; if(str) pa.insertBefore(el, hoo); else{ pa.appendChild(el); return; } } }}Run.godeep= function(hoo, fun, arg){ var A= []; if(hoo){ hoo= hoo.firstChild; while(hoo!= null){ if(hoo.nodeType== 3){ if(hoo.data) A[A.length]= fun(hoo, arg); } else A= A.concat(arguments.callee(hoo, fun, arg)); hoo= hoo.nextSibling; } } return A;}//test**Run.godeep(document.body, Run.makestrong,/([Ee]+)/g);**