Skip to content

Commit

Permalink
fix(tooltip): fix potential NPE when the parent node of the tooltip e…
Browse files Browse the repository at this point in the history
…lement doesn't exist (#19265)

* fix(tooltip): use `remove` rather than `parentNode.removeChild` to fix potential NPE when its parent node doesn't exists. (#19248)

* fix(tooltip): clearTimeout when disposing

* fix(tooltip): still use `parentNode.removeChild` to reserve support for IE.
  • Loading branch information
plainheart authored Nov 6, 2023
1 parent 818853e commit fd9e62d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/component/tooltip/TooltipHTMLContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ class TooltipHTMLContent {
}

dispose() {
this.el.parentNode.removeChild(this.el);
clearTimeout(this._hideTimeout);
clearTimeout(this._longHideTimeout);

const parentNode = this.el.parentNode;
parentNode && parentNode.removeChild(this.el);
this.el = this._container = null;
}

Expand Down

0 comments on commit fd9e62d

Please sign in to comment.