Skip to content

Commit 02c3340

Browse files
committed
refactor: 精简代码
1 parent a3d60af commit 02c3340

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

src/BootstrapBlazor/wwwroot/modules/utility.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -571,28 +571,23 @@ const hackPopover = (popover, css) => {
571571
}
572572

573573
const hackTooltip = function () {
574-
window.BootstrapBlazor ??= {};
575-
576-
if (window.BootstrapBlazor.Tooltip === void 0) {
577-
window.BootstrapBlazor.Tooltip = {
578-
hooked: false,
579-
hackDispose: function () {
580-
if (this.hooked === false) {
581-
this.hooked = true;
582-
583-
const originalDispose = bootstrap.Tooltip.prototype.dispose;
584-
bootstrap.Tooltip.prototype.dispose = function () {
585-
originalDispose.call(this);
586-
// fix https://github.com/twbs/bootstrap/issues/37474
587-
this._activeTrigger = {};
588-
this._element = document.createElement('noscript'); // placeholder with no behavior
589-
}
574+
const tooltip = registerBootstrapBlazorModule('Tooltip', {
575+
hooked: false,
576+
hackDispose: function () {
577+
if (this.hooked === false) {
578+
this.hooked = true;
579+
580+
const originalDispose = bootstrap.Tooltip.prototype.dispose;
581+
bootstrap.Tooltip.prototype.dispose = function () {
582+
originalDispose.call(this);
583+
// fix https://github.com/twbs/bootstrap/issues/37474
584+
this._activeTrigger = {};
585+
this._element = document.createElement('noscript'); // placeholder with no behavior
590586
}
591587
}
592588
}
593-
}
594-
595-
window.BootstrapBlazor.Tooltip.hackDispose();
589+
});
590+
tooltip.hackDispose();
596591
}
597592

598593
const setIndeterminate = (object, state) => {

0 commit comments

Comments
 (0)