請(qǐng)問(wèn)什么意思?這段代碼
for(var i=0;i<content.childNodes.length;i++){
? ? ? if(content.childNodes[i].nodeType!=1){? ?
? ? ? ? ?continue;??
? ? ? }else{
? ? ? ? ?content.removeChild(content.childNodes[i]);? ??
? ? ? }
? ? ? ? ?
? ? ? }
for(var i=0;i<content.childNodes.length;i++){
? ? ? if(content.childNodes[i].nodeType!=1){? ?
? ? ? ? ?continue;??
? ? ? }else{
? ? ? ? ?content.removeChild(content.childNodes[i]);? ??
? ? ? }
? ? ? ? ?
? ? ? }
2018-08-19
舉報(bào)
2018-08-24
通過(guò)nodeType的值是否為1(元素節(jié)點(diǎn)nodeType的值為1)來(lái)去掉空白看不見(jiàn)的那部分節(jié)點(diǎn)
2018-08-20
你去掉判斷試試,看看有啥不同。(結(jié)合9-8的空白節(jié)點(diǎn)考慮考慮)