Stop dispatching extraneous pjax:complete events, correct typo
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
module.exports = function(el) {
|
module.exports = function(el) {
|
||||||
// console.log("going to execute script", el)
|
|
||||||
|
|
||||||
var code = (el.text || el.textContent || el.innerHTML || "")
|
var code = (el.text || el.textContent || el.innerHTML || "")
|
||||||
var src = (el.src || "");
|
var src = (el.src || "");
|
||||||
var parent = el.parentNode || document.querySelector("head") || document.documentElement
|
var parent = el.parentNode || document.querySelector("head") || document.documentElement
|
||||||
@@ -17,8 +15,7 @@ module.exports = function(el) {
|
|||||||
|
|
||||||
if (src != "") {
|
if (src != "") {
|
||||||
script.src = src;
|
script.src = src;
|
||||||
script.onload = function() { document.dispatchEvent((new Event("pjax:complete"))); }
|
script.async = false; // force synchronous loading of peripheral js
|
||||||
script.async = false; // force asynchronous loading of peripheral js
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code != "") {
|
if (code != "") {
|
||||||
|
|||||||
Reference in New Issue
Block a user