Fix using custom function witl elements in TreeWalker

This commit is contained in:
varjolintu 2025-09-04 16:14:03 +03:00
parent 1b547aca4d
commit 0aa321035c

View file

@ -330,7 +330,9 @@ const getShadowDOM = function(elem) {
const treeWalkerFilter = function(node) {
return !node ||
node?.disabled ||
(typeof node?.getAttribute !== 'undefined' && node?.getLowerCaseAttribute('type') === 'hidden')
(node instanceof Element
&& typeof node?.getAttribute === 'function'
&& node?.getLowerCaseAttribute('type') === 'hidden')
? NodeFilter.FILTER_REJECT
: NodeFilter.FILTER_ACCEPT;
};