This is an automated email from the ASF dual-hosted git repository. wangzx pushed a commit to branch fix/tooltip in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/fix/tooltip by this push: new 260d078 tweak(tooltip): use `appendChild` but not concat html string for tooltip arrow. 260d078 is described below commit 260d07847bc352fdd1db0492ddadbb6a7b31ee0b Author: plainheart <y...@all-my-life.cn> AuthorDate: Thu Oct 8 13:10:41 2020 +0800 tweak(tooltip): use `appendChild` but not concat html string for tooltip arrow. --- src/component/tooltip/TooltipHTMLContent.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/component/tooltip/TooltipHTMLContent.ts b/src/component/tooltip/TooltipHTMLContent.ts index ccbf365..bc44046 100644 --- a/src/component/tooltip/TooltipHTMLContent.ts +++ b/src/component/tooltip/TooltipHTMLContent.ts @@ -76,15 +76,14 @@ function assembleArrow( }).join(';') const styleCss = [ - 'style="position:absolute;width:10px;height:10px;', + 'position:absolute;width:10px;height:10px;', `${positionStyle}${transformStyle};`, `border-bottom: ${borderColor} solid 1px;`, `border-right: ${borderColor} solid 1px;`, `background-color: ${backgroundColor};`, - 'box-shadow: 8px 8px 16px -3px #000', - '"' + 'box-shadow: 8px 8px 16px -3px #000;' ]; - return `<div ${styleCss.join('')}></div>`; + return styleCss.join(''); } function assembleTransition(duration: number): string { @@ -355,13 +354,15 @@ class TooltipHTMLContent { return; } this.el.innerHTML = content; - this.el.innerHTML += ( - isString(arrowPosition) - && tooltipModel.get('trigger') === 'item' - && !shouldTooltipConfine(tooltipModel) - ) - ? assembleArrow(tooltipModel.get('backgroundColor'), borderColor, arrowPosition) - : ''; + + if (isString(arrowPosition) && tooltipModel.get('trigger') === 'item' + && !shouldTooltipConfine(tooltipModel)) { + + const arrow = document.createElement('div'); + arrow.style.cssText = assembleArrow(tooltipModel.get('backgroundColor'), borderColor, arrowPosition); + + this.el.appendChild(arrow); + } } setEnterable(enterable: boolean) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org