From b11c3bb49ea5714bedbaef1e7bb743c21eeef3b4 Mon Sep 17 00:00:00 2001 From: Sebastian Brandes Date: Tue, 28 Nov 2023 15:36:47 +0100 Subject: [PATCH] Check if bootstrap exists --- .../wwwroot/HxPopover.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Havit.Blazor.Components.Web.Bootstrap/wwwroot/HxPopover.js b/Havit.Blazor.Components.Web.Bootstrap/wwwroot/HxPopover.js index 8161cce24..86c50ef9b 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/wwwroot/HxPopover.js +++ b/Havit.Blazor.Components.Web.Bootstrap/wwwroot/HxPopover.js @@ -1,6 +1,6 @@ // has to be aligned with HxTooltip.js! export function initialize(element, hxDotnetObjectReference, options) { - if (!element) { + if (!bootstrap || !element) { return; } element.hxDotnetObjectReference = hxDotnetObjectReference; @@ -10,6 +10,9 @@ export function initialize(element, hxDotnetObjectReference, options) { } export function show(element) { + if (!bootstrap) { + return; + } var i = bootstrap.Popover.getInstance(element); if (i) { i.show(); @@ -17,6 +20,9 @@ export function show(element) { } export function hide(element) { + if (!bootstrap) { + return; + } var i = bootstrap.Popover.getInstance(element); if (i) { i.hide(); @@ -24,6 +30,9 @@ export function hide(element) { } export function enable(element) { + if (!bootstrap) { + return; + } var i = bootstrap.Popover.getInstance(element); if (i) { i.enable(); @@ -32,6 +41,9 @@ export function enable(element) { } export function disable(element) { + if (!bootstrap) { + return; + } var i = bootstrap.Popover.getInstance(element); if (i) { i.disable(); @@ -40,6 +52,9 @@ export function disable(element) { } export function setContent(element, newContent) { + if (!bootstrap) { + return; + } var i = bootstrap.Popover.getInstance(element); if (i) { i.setContent(newContent); @@ -55,7 +70,7 @@ function handleHidden(event) { }; export function dispose(element) { - if (!element) { + if (!bootstrap || !element) { return; } element.removeEventListener('shown.bs.popover', handleShown);