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
This commit is contained in:
Raymond Hill 2021-06-17 09:58:18 -04:00
parent 6291168e9a
commit 090614dd18
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 2 additions and 2 deletions

View File

@ -935,7 +935,7 @@ vAPI.DOMFilterer = class {
if ( node.localName === 'iframe' ) { if ( node.localName === 'iframe' ) {
addIFrame(node); addIFrame(node);
} }
if ( node.childElementCount === 0 ) { continue; } if ( node.firstElementChild === null ) { continue; }
const iframes = node.getElementsByTagName('iframe'); const iframes = node.getElementsByTagName('iframe');
if ( iframes.length !== 0 ) { if ( iframes.length !== 0 ) {
addIFrames(iframes); addIFrames(iframes);
@ -1175,7 +1175,7 @@ vAPI.DOMFilterer = class {
while ( i-- ) { while ( i-- ) {
const node = addedNodes[i]; const node = addedNodes[i];
pendingNodes.add([ node ]); pendingNodes.add([ node ]);
if ( node.childElementCount === 0 ) { continue; } if ( node.firstElementChild === null ) { continue; }
pendingNodes.add(node.querySelectorAll('[id],[class]')); pendingNodes.add(node.querySelectorAll('[id],[class]'));
} }
if ( pendingNodes.hasNodes() ) { if ( pendingNodes.hasNodes() ) {