Skip to content

Commit 301c65b

Browse files
committed
refactor: 精简代码
1 parent 27d62b6 commit 301c65b

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/BootstrapBlazor/wwwroot/modules/utility.js

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

573573
const hackTooltip = function () {
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
586-
}
587-
}
574+
const mock = () => {
575+
const originalDispose = bootstrap.Tooltip.prototype.dispose;
576+
bootstrap.Tooltip.prototype.dispose = function () {
577+
originalDispose.call(this);
578+
// fix https://github.com/twbs/bootstrap/issues/37474
579+
this._activeTrigger = {};
580+
this._element = document.createElement('noscript'); // placeholder with no behavior
588581
}
589-
});
590-
tooltip.hackDispose();
582+
}
583+
registerBootstrapBlazorModule('Tooltip', null, mock);
591584
}
592585

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

0 commit comments

Comments
 (0)