@next-theme/pjax
Version:
Easily enable fast AJAX navigation on any website (using pushState + XHR)
14 lines (12 loc) • 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);
};