File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -92,13 +92,20 @@ if (elem) {
9292 } ;
9393 } ;
9494
95- // Bind on ready callback.
95+ // Bind on ready callbacks to DOMContentLoaded (native js) and turbolinks:load
96+ // Turbolinks replaces the body and merges the head of an HTML page.
97+ // Since the body is already loaded (DOMContentLoaded), the event is not triggered.
9698 if ( doc . addEventListener ) {
99+ // This ensures that all event listeners get applied only once.
97100 if ( ! window . __debugKitListenersApplied ) {
101+ // The DOMContentLoaded is for all pages that do not have Turbolinks
98102 doc . addEventListener ( 'DOMContentLoaded' , onReady , false ) ;
99103 doc . addEventListener ( 'DOMContentLoaded' , proxyAjaxOpen , false ) ;
100104 doc . addEventListener ( 'DOMContentLoaded' , proxyAjaxSend , false ) ;
101105
106+ // turbolinks:load is the alternative DOMContentLoaded Event of Turbolinks
107+ // https://github.com/turbolinks/turbolinks
108+ // https://github.com/cakephp/debug_kit/pull/664
102109 doc . addEventListener ( 'turbolinks:load' , onReady , false ) ;
103110 doc . addEventListener ( 'turbolinks:load' , proxyAjaxOpen , false ) ;
104111 doc . addEventListener ( 'turbolinks:load' , proxyAjaxSend , false ) ;
You can’t perform that action at this time.
0 commit comments