From 090614dd18e2be6fdc4e91433aeff76140d070fd Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 17 Jun 2021 09:58:18 -0400 Subject: [PATCH] Use `firstElementChild` instead of `childElementCount` Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1620 Related bugzilla issue: - https://bugzilla.mozilla.org/show_bug.cgi?id=1715841 --- src/js/contentscript.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/contentscript.js b/src/js/contentscript.js index f527bfaf9..aaf996249 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -935,7 +935,7 @@ vAPI.DOMFilterer = class { if ( node.localName === 'iframe' ) { addIFrame(node); } - if ( node.childElementCount === 0 ) { continue; } + if ( node.firstElementChild === null ) { continue; } const iframes = node.getElementsByTagName('iframe'); if ( iframes.length !== 0 ) { addIFrames(iframes); @@ -1175,7 +1175,7 @@ vAPI.DOMFilterer = class { while ( i-- ) { const node = addedNodes[i]; pendingNodes.add([ node ]); - if ( node.childElementCount === 0 ) { continue; } + if ( node.firstElementChild === null ) { continue; } pendingNodes.add(node.querySelectorAll('[id],[class]')); } if ( pendingNodes.hasNodes() ) {