* Lots of code cleanup * Cleanup parse-options tests - Rename objects for clarity and inline unneeded objects - Remove unneeded tests - Use Object.keys().length instead of a custom function - Use typeof === "object" instead of a custom function that checks the prototype tree as well, since we don't expect anything but an object literal. * Remove old switchFallback code * Remove polyfill for Function.prototype.bind * Inline small functions * Add more documentation and tests for options.currentUrlFullReload Closes #17 * Update package.json
10 lines
297 B
JavaScript
10 lines
297 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)
|
|
}
|