This commit is contained in:
yanlong.wang 2024-08-01 19:51:53 +08:00
parent 54fa5feb7f
commit f4f189c8e6
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37

View File

@ -126,7 +126,10 @@ function getMaxDepthAndCountUsingTreeWalker(root) {
const treeWalker = document.createTreeWalker(
root,
NodeFilter.SHOW_ELEMENT,
(node) => (node.nodeName.toLowerCase() === 'svg' || node.nodeName.toLowerCase() === 'code') ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT,
(node) => {
const nodeName = node.nodeName.toLowerCase();
return (nodeName === 'svg' || nodeName === 'code') ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
},
false
);