Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 985 Bytes

no-nodelist-unsupported-methods.md

File metadata and controls

34 lines (26 loc) · 985 Bytes

no-nodelist-unsupported-methods

Prohibits NodeList methods not supported by Chrome<51, Firefox<50, Safari<10, IE & others

📋 This rule is enabled in plugin:mediawiki/common.

Rule details

❌ Examples of incorrect code:

element.childNodes.forEach();
element.childNodes.entries();
element.childNodes.keys();
element.childNodes.values();
document.querySelectorAll( '.foo' ).forEach();

✔️ Examples of correct code:

Array.prototype.forEach.call( element.childNodes, function ( element ) {} );
[].forEach();
[].property.forEach();
[].method().forEach();
element.childNodes.item( 1 );
document.querySelectorAll( '.foo' ).item( 1 );
forEach();

Resources