2014-10-14 11:42:36 +02:00
|
|
|
/* global HTMLCollection: true */
|
|
|
|
|
|
2014-05-04 08:45:05 +02:00
|
|
|
module.exports = function(els, fn, context) {
|
2019-02-13 22:26:57 -05:00
|
|
|
if (
|
|
|
|
|
els instanceof HTMLCollection ||
|
|
|
|
|
els instanceof NodeList ||
|
|
|
|
|
els instanceof Array
|
|
|
|
|
) {
|
|
|
|
|
return Array.prototype.forEach.call(els, fn, context);
|
2014-05-04 08:45:05 +02:00
|
|
|
}
|
2018-02-02 09:52:44 -05:00
|
|
|
// assume simple DOM element
|
2019-02-13 22:26:57 -05:00
|
|
|
return fn.call(context, els);
|
|
|
|
|
};
|