Files
pjax/lib/foreach-els.js
Behind The Math 2e459fb7bc Prettier fixes
2019-02-11 23:17:28 -05:00

14 lines
316 B
JavaScript

/* global HTMLCollection: true */
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);
};