Test forEachEls
This commit is contained in:
7
src/scripts/lib/foreach-els.js
Normal file
7
src/scripts/lib/foreach-els.js
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = function(els, fn, context) {
|
||||
if (els instanceof HTMLCollection || els instanceof NodeList || els instanceof Array) {
|
||||
return Array.prototype.forEach.call(els, fn, context)
|
||||
}
|
||||
// assume simple dom element
|
||||
return fn.call(context, els)
|
||||
}
|
||||
Reference in New Issue
Block a user