| commit | 7e8884b6db05142e2a585a1bd593676dc19dcfc9 | [log] [tgz] |
|---|---|---|
| author | plainheart <yhen@all-my-life.cn> | Tue Jul 13 10:21:46 2021 +0800 |
| committer | plainheart <yhen@all-my-life.cn> | Tue Jul 13 10:24:54 2021 +0800 |
| tree | d55e5dfe9390ad9e0e68135d45dffd42c9d2ce0b | |
| parent | edc4367c8da2c8e2189971c470912ffdd62cb0ca [diff] |
fix(tooltip): should clear the DOM content if user-specified content is null, resolves #14832. Related previous commit: https://github.com/apache/echarts/pull/12947/commits/3ddb125af1870c233b5d3d8c345bdd17015851eb
diff --git a/src/component/tooltip/TooltipHTMLContent.ts b/src/component/tooltip/TooltipHTMLContent.ts index 73b5b2b..a1e2ac9 100644 --- a/src/component/tooltip/TooltipHTMLContent.ts +++ b/src/component/tooltip/TooltipHTMLContent.ts
@@ -403,7 +403,10 @@ borderColor?: ZRColor, arrowPosition?: TooltipOption['position'] ) { + const el = this.el; + if (content == null) { + el.innerHTML = ''; return; } @@ -412,7 +415,6 @@ && !shouldTooltipConfine(tooltipModel)) { arrow = assembleArrow(tooltipModel.get('backgroundColor'), borderColor, arrowPosition); } - const el = this.el; if (isString(content)) { el.innerHTML = content + arrow; }