Loading csp_extras/js/ajax.js +20 −0 Changes for csp_extras/js/ajax.js: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,17 @@ * The XMLHttpRequest status. */ Drupal.AjaxCommands.prototype.add_assets = function (ajax, response, status) { var assetsLoaded = 0; function onAssetLoad() { assetsLoaded += 1; // When new scripts are loaded, attach newly added behaviors. if (assetsLoaded >= response.assets.length) { Drupal.attachBehaviors(document.body, ajax.settings); } } response.assets.forEach(function (item) { var elem; var target = document.body; Loading @@ -37,6 +48,15 @@ elem[key] = item.attributes[key]; }); if (item.type === "script") { elem.onload = onAssetLoad; } else { // Directly mark this element as loaded. We don't have to wait before // behaviours can be attached. onAssetLoad(); } target.appendChild(elem); }); }; Loading Loading
csp_extras/js/ajax.js +20 −0 Changes for csp_extras/js/ajax.js: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,17 @@ * The XMLHttpRequest status. */ Drupal.AjaxCommands.prototype.add_assets = function (ajax, response, status) { var assetsLoaded = 0; function onAssetLoad() { assetsLoaded += 1; // When new scripts are loaded, attach newly added behaviors. if (assetsLoaded >= response.assets.length) { Drupal.attachBehaviors(document.body, ajax.settings); } } response.assets.forEach(function (item) { var elem; var target = document.body; Loading @@ -37,6 +48,15 @@ elem[key] = item.attributes[key]; }); if (item.type === "script") { elem.onload = onAssetLoad; } else { // Directly mark this element as loaded. We don't have to wait before // behaviours can be attached. onAssetLoad(); } target.appendChild(elem); }); }; Loading