Test forEachEls

This commit is contained in:
Maxime Thirouin committed 2014-10-14 08:03:43 +02:00
1 parent fa27e05606
commit 9ac709b5d8
2 files changed
+52

No files matched your search

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