diff --git a/backend/functions/src/services/puppeteer.ts b/backend/functions/src/services/puppeteer.ts index ed35860..b2f5877 100644 --- a/backend/functions/src/services/puppeteer.ts +++ b/backend/functions/src/services/puppeteer.ts @@ -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 );