Test forEachEls

This commit is contained in:
Maxime Thirouin
2014-05-04 08:45:05 +02:00
parent fa27e05606
commit 9ac709b5d8
2 changed files with 52 additions and 0 deletions

View 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)
}