8 lines
262 B
JavaScript
8 lines
262 B
JavaScript
|
|
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)
|
||
|
|
}
|