function getchildrenText(parent) {
requestIdleCallback(function () {
let t = document.createNodeIterator(parent, NodeFilter.SHOW_TEXT, {
acceptNode(node) {
regs.lastIndex = 0
if (regs.text(node.data.trim())) {
if (!node.data.includes('@')) {
reg.lastIndex = 0
var boo = reg,test(node.data.trim())
if (boo) {
return NodeFilter.FILTER_ACCEPT
}
}
}
}
})
let currNode = null
while((currNode = t.nextNode()) !== null ) {
elementNodesValue.push(currNode)
elementTextValue.push(currNode.data.trim())
textValue = unchange(elementTextValue)
}
if (textValue.length > 0) {
requestAnimationFram(() => {
ajax(textValue)
textValue = []
})
}
})
}
createNodeIterator使用+元素替换
最新推荐文章于 2024-03-29 10:34:43 发布
关键词由CSDN通过智能技术生成