Relocate all the things

This commit is contained in:
Maxime Thirouin
2014-10-14 08:23:56 +02:00
parent 414650113b
commit 165532d43c
33 changed files with 12512 additions and 16 deletions

15
lib/execute-scripts.js Normal file
View File

@@ -0,0 +1,15 @@
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) {
// console.log("going to execute scripts for ", el)
forEachEls(el.querySelectorAll("script"), function(script) {
if (!script.type || script.type.toLowerCase() === "text/javascript") {
if (script.parentNode) {
script.parentNode.removeChild(script)
}
evalScript(script)
}
})
}