Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions webroot/js/inject-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,14 @@ if (elem) {
};
};

// Bind on ready callbacks to DOMContentLoaded (native js) and turbolinks:load
// Turbolinks replaces the body and merges the head of an HTML page.
// Bind on ready callbacks to DOMContentLoaded (native js)
// Since the body is already loaded (DOMContentLoaded), the event is not triggered.
if (doc.addEventListener) {
// This ensures that all event listeners get applied only once.
if (!win.debugKitListenersApplied) {
// The DOMContentLoaded is for all pages that do not have Turbolinks
doc.addEventListener('DOMContentLoaded', onReady, false);
doc.addEventListener('DOMContentLoaded', proxyAjaxOpen, false);
doc.addEventListener('DOMContentLoaded', proxyAjaxSend, false);

// turbolinks:load is the alternative DOMContentLoaded Event of Turbolinks
// https://github.com/turbolinks/turbolinks
// https://github.com/cakephp/debug_kit/pull/664
doc.addEventListener('turbolinks:load', onReady, false);
doc.addEventListener('turbolinks:load', proxyAjaxOpen, false);
doc.addEventListener('turbolinks:load', proxyAjaxSend, false);
win.debugKitListenersApplied = true;
}
} else {
Expand Down