From 15f82df2b9e5955fe04752b1c507d011f1b19cc4 Mon Sep 17 00:00:00 2001 From: Sergio Alcaraz Date: Fri, 3 May 2024 10:16:41 -0400 Subject: [PATCH] Fix: When determining whether Turbo exists it throws undefined --- webroot/js/inject-iframe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webroot/js/inject-iframe.js b/webroot/js/inject-iframe.js index 25e7e584..9877f7a8 100644 --- a/webroot/js/inject-iframe.js +++ b/webroot/js/inject-iframe.js @@ -100,7 +100,7 @@ if (elem) { if (!win.debugKitListenersApplied) { // Add support for turbo DOMContentLoaded alternative // see https://turbo.hotwired.dev/reference/events#turbo%3Aload - const loadedEvent = Turbo ? 'turbo:load' : 'DOMContentLoaded'; + const loadedEvent = typeof Turbo !== 'undefined' && Turbo !== null ? 'turbo:load' : 'DOMContentLoaded'; doc.addEventListener(loadedEvent, onReady, false); doc.addEventListener(loadedEvent, proxyAjaxOpen, false); doc.addEventListener(loadedEvent, proxyAjaxSend, false);