From e160a04ebf60bd4c05ad748021a9dbeebf0bbe36 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Fri, 13 May 2022 14:45:49 +0200 Subject: [PATCH] fix(turbo): avoid crashing IE 11 with non get/post methods --- patches/@hotwired+turbo+7.1.0.patch | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/patches/@hotwired+turbo+7.1.0.patch b/patches/@hotwired+turbo+7.1.0.patch index d6b551b3e..8b1a5ed6c 100644 --- a/patches/@hotwired+turbo+7.1.0.patch +++ b/patches/@hotwired+turbo+7.1.0.patch @@ -1,7 +1,16 @@ diff --git a/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js b/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js -index 963422f..65364f1 100644 +index 963422f..a4113bf 100644 --- a/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js +++ b/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js +@@ -2609,7 +2609,7 @@ class Session { + const linkMethod = link.getAttribute("data-turbo-method"); + if (linkMethod) { + const form = document.createElement("form"); +- form.method = linkMethod; ++ form.setAttribute('method', linkMethod); + form.action = link.getAttribute("href") || "undefined"; + form.hidden = true; + if (link.hasAttribute("data-turbo-confirm")) { @@ -2621,9 +2621,9 @@ class Session { form.addEventListener("turbo:submit-start", () => form.remove()); } @@ -15,9 +24,18 @@ index 963422f..65364f1 100644 } else { diff --git a/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js b/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js -index 101db1f..ce43031 100644 +index 101db1f..7d9cda6 100644 --- a/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js +++ b/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js +@@ -2615,7 +2615,7 @@ Copyright © 2021 Basecamp, LLC + const linkMethod = link.getAttribute("data-turbo-method"); + if (linkMethod) { + const form = document.createElement("form"); +- form.method = linkMethod; ++ form.setAttribute('method', linkMethod); + form.action = link.getAttribute("href") || "undefined"; + form.hidden = true; + if (link.hasAttribute("data-turbo-confirm")) { @@ -2627,9 +2627,9 @@ Copyright © 2021 Basecamp, LLC form.addEventListener("turbo:submit-start", () => form.remove()); }