Added support do do a push-state ajax request with forms
This commit is contained in:
@@ -2,7 +2,7 @@ module.exports = function(el) {
|
||||
// console.log("going to execute script", el)
|
||||
|
||||
var code = (el.text || el.textContent || el.innerHTML || "")
|
||||
var head = document.querySelector("head") || document.documentElement
|
||||
var parent = el.parentNode || document.querySelector("head") || document.documentElement
|
||||
var script = document.createElement("script")
|
||||
|
||||
if (code.match("document.write")) {
|
||||
@@ -22,8 +22,11 @@ module.exports = function(el) {
|
||||
}
|
||||
|
||||
// execute
|
||||
head.insertBefore(script, head.firstChild)
|
||||
head.removeChild(script) // avoid pollution
|
||||
parent.appendChild(script);
|
||||
// avoid pollution only in head or body tags
|
||||
if (["head","body"].indexOf(parent.tagName.toLowerCase()) > 0) {
|
||||
parent.removeChild(script)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user