From d7e65e677d2a0efc438b1092ce9533c78807e283 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Tue, 2 Jul 2024 03:52:45 +0000 Subject: [PATCH] Remove Safari 14.0 patch for delegatesFocus --- cast/src/launcher/entrypoint.ts | 1 - demo/src/entrypoint.ts | 1 - hassio/src/entrypoint.ts | 1 - src/entrypoints/authorize.ts | 1 - src/entrypoints/core.ts | 1 - src/entrypoints/custom-panel.ts | 1 - src/entrypoints/onboarding.ts | 1 - src/resources/safari-14-attachshadow-patch.ts | 17 ----------------- 8 files changed, 24 deletions(-) delete mode 100644 src/resources/safari-14-attachshadow-patch.ts diff --git a/cast/src/launcher/entrypoint.ts b/cast/src/launcher/entrypoint.ts index 423e3165e771..f7d615d45857 100644 --- a/cast/src/launcher/entrypoint.ts +++ b/cast/src/launcher/entrypoint.ts @@ -1,4 +1,3 @@ -import "../../../src/resources/safari-14-attachshadow-patch"; import "./layout/hc-connect"; import("../../../src/resources/ha-style"); diff --git a/demo/src/entrypoint.ts b/demo/src/entrypoint.ts index e02049326436..e153eabb128c 100644 --- a/demo/src/entrypoint.ts +++ b/demo/src/entrypoint.ts @@ -1,4 +1,3 @@ -import "../../src/resources/safari-14-attachshadow-patch"; import "./util/is_frontpage"; import "./ha-demo"; diff --git a/hassio/src/entrypoint.ts b/hassio/src/entrypoint.ts index 35a7e8647b13..eabfb7e5e590 100644 --- a/hassio/src/entrypoint.ts +++ b/hassio/src/entrypoint.ts @@ -1,6 +1,5 @@ // Compat needs to be first import import "../../src/resources/compatibility"; -import "../../src/resources/safari-14-attachshadow-patch"; import "./hassio-main"; import("../../src/resources/ha-style"); diff --git a/src/entrypoints/authorize.ts b/src/entrypoints/authorize.ts index cc3e208d8194..047e80be1890 100644 --- a/src/entrypoints/authorize.ts +++ b/src/entrypoints/authorize.ts @@ -1,7 +1,6 @@ // Compat needs to be first import import "../resources/compatibility"; import "../auth/ha-authorize"; -import "../resources/safari-14-attachshadow-patch"; import("../resources/ha-style"); import("@polymer/polymer/lib/utils/settings").then( diff --git a/src/entrypoints/core.ts b/src/entrypoints/core.ts index bcd6138a0dc2..c0b83b90cc7a 100644 --- a/src/entrypoints/core.ts +++ b/src/entrypoints/core.ts @@ -25,7 +25,6 @@ import { subscribePanels } from "../data/ws-panels"; import { subscribeThemes } from "../data/ws-themes"; import { subscribeUser } from "../data/ws-user"; import type { ExternalAuth } from "../external_app/external_auth"; -import "../resources/safari-14-attachshadow-patch"; window.name = MAIN_WINDOW_NAME; (window as any).frontendVersion = __VERSION__; diff --git a/src/entrypoints/custom-panel.ts b/src/entrypoints/custom-panel.ts index b0b759ba775b..c12674a98e0a 100644 --- a/src/entrypoints/custom-panel.ts +++ b/src/entrypoints/custom-panel.ts @@ -1,6 +1,5 @@ // Compat needs to be first import import "../resources/compatibility"; -import "../resources/safari-14-attachshadow-patch"; import { CSSResult } from "lit"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/entrypoints/onboarding.ts b/src/entrypoints/onboarding.ts index 9deb7359271c..87539e965a9b 100644 --- a/src/entrypoints/onboarding.ts +++ b/src/entrypoints/onboarding.ts @@ -1,7 +1,6 @@ // Compat needs to be first import import "../resources/compatibility"; import "../onboarding/ha-onboarding"; -import "../resources/safari-14-attachshadow-patch"; import("../resources/ha-style"); import("@polymer/polymer/lib/utils/settings").then( diff --git a/src/resources/safari-14-attachshadow-patch.ts b/src/resources/safari-14-attachshadow-patch.ts deleted file mode 100644 index a3a41ce4bdab..000000000000 --- a/src/resources/safari-14-attachshadow-patch.ts +++ /dev/null @@ -1,17 +0,0 @@ -// https://github.com/home-assistant/frontend/pull/7031 - -export {}; // for Babel to treat as a module - -const isSafari14 = /^((?!chrome|android).)*version\/14\.0\s.*safari/i.test( - navigator.userAgent -); - -if (isSafari14) { - const origAttachShadow = window.Element.prototype.attachShadow; - window.Element.prototype.attachShadow = function (init) { - if (init && init.delegatesFocus) { - delete init.delegatesFocus; - } - return origAttachShadow.apply(this, [init]); - }; -}