為什么要判斷節(jié)點(diǎn)是否為元素節(jié)點(diǎn)
?for(var i=0;i<content.childNodes.length;i++){
? ? ? if(content.childNodes[i].nodeType!=1){ ??
? ? ? ? ?continue; ?
? ? ? }else{
? ? ? ? ?content.removeChild(content.childNodes[i]); ? ?
? ? ? }
?if(content.childNodes[i].nodeType!=1){ ? 這節(jié)要求刪除所有節(jié)點(diǎn),那不是要把文本節(jié)點(diǎn)一起刪掉么,為什么還要判斷呢
2018-08-21
確實(shí)不需要判斷都刪了就好