* 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
19 lines
557 B
JavaScript
19 lines
557 B
JavaScript
var forEachEls = require("./foreach-els")
|
|
var evalScript = require("./eval-script")
|
|
// Finds and executes scripts (used for newly added elements)
|
|
// Needed since innerHTML does not run scripts
|
|
module.exports = function(el) {
|
|
if (el.tagName.toLowerCase() === "script") {
|
|
evalScript(el)
|
|
}
|
|
|
|
forEachEls(el.querySelectorAll("script"), function(script) {
|
|
if (!script.type || script.type.toLowerCase() === "text/javascript") {
|
|
if (script.parentNode) {
|
|
script.parentNode.removeChild(script)
|
|
}
|
|
evalScript(script)
|
|
}
|
|
})
|
|
}
|