From f05dfe4398e06143ccfe8c106c5fde64799779a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Fern=C3=A1ndez-Capel?= Date: Fri, 9 Feb 2024 09:31:46 +0000 Subject: [PATCH] Remove unnecessary `isUJS` example (#162) That kind of check is not needed since https://github.com/hotwired/turbo/pull/1178 --- _source/handbook/02_drive.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/_source/handbook/02_drive.md b/_source/handbook/02_drive.md index deab837..67806be 100644 --- a/_source/handbook/02_drive.md +++ b/_source/handbook/02_drive.md @@ -361,18 +361,11 @@ You can also disable the behaviour programatically by intercepting the `turbo:be ```javascript document.addEventListener("turbo:before-prefetch", (event) => { - if (isUJS(event.target) || isSavingData() || hasSlowInternet()) { + if (isSavingData() || hasSlowInternet()) { event.preventDefault() } }) -function isUJS(link) { - return link.hasAttribute("data-remote") || - link.hasAttribute("data-behavior") || - link.hasAttribute("data-method") || - link.hasAttribute("data-confirm") -} - function isSavingData() { return navigator.connection?.saveData }