Skip to content

Commit

Permalink
fix: label dom leak when chart re-render (#5392)
Browse files Browse the repository at this point in the history
* fix: label dom leak when chart re-render

* chore: update demo

* chore: update snapshots of tooltip

* chore: update snapshots

---------

Co-authored-by: yuqi.pyq <[email protected]>
  • Loading branch information
hustcc and xiaoiver authored Aug 15, 2023
1 parent bb387ea commit 18e6626
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<foreignObject xmlns="http://www.w3.org/2000/svg" fill="none" class="poptip">
<foreignObject xmlns="http://www.w3.org/2000/svg" class="poptip">
<div xmlns="http://www.w3.org/1999/xhtml">
<div style="background-color:red;color:#fff;width:max-content;padding:1px 4px;font-size:12px;border-radius:2.5px;box-shadow:0 3px 6px -4px rgba(0,0,0,0.12), 0 6px 16px 0 rgba(0,0,0,0.08), 0 9px 28px 8px rgba(0,0,0,0.05)">
Rectangle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<foreignObject xmlns="http://www.w3.org/2000/svg" fill="none" class="poptip">
<foreignObject xmlns="http://www.w3.org/2000/svg" class="poptip">
<div xmlns="http://www.w3.org/1999/xhtml">
<div style="background-color:rgba(0,0,0,0.75);color:#fff;width:max-content;padding:1px 4px;font-size:12px;border-radius:2.5px;box-shadow:0 3px 6px -4px rgba(0,0,0,0.12), 0 6px 16px 0 rgba(0,0,0,0.08), 0 9px 28px 8px rgba(0,0,0,0.05)">
Rectangle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<foreignObject xmlns="http://www.w3.org/2000/svg" fill="none" class="poptip">
<foreignObject xmlns="http://www.w3.org/2000/svg" class="poptip">
<div xmlns="http://www.w3.org/1999/xhtml">
<div style="background-color:rgba(0,0,0,0.75);color:#fff;width:max-content;padding:1px 4px;font-size:12px;border-radius:2.5px;box-shadow:0 3px 6px -4px rgba(0,0,0,0.12), 0 6px 16px 0 rgba(0,0,0,0.08), 0 9px 28px 8px rgba(0,0,0,0.05)">
Rectangle
Expand Down
5 changes: 0 additions & 5 deletions __tests__/plots/static/alphabet-interval-html-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ export function alphabetIntervalHtmlLabel(): G2Spec {
labels: [
{
text: 'frequency',
transform: [
{
type: 'overlapHide',
},
],
className: 'alphabet-labels',
render: (
_,
Expand Down
3 changes: 1 addition & 2 deletions src/shape/text/advance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ function inferConnectorPath(

export const Advance = createElement((g) => {
const {
id,
className,
// Do not pass className
class: _c,
Expand Down Expand Up @@ -170,7 +169,7 @@ export const Advance = createElement((g) => {
// Use html to customize advance text.
if (innerHTML) {
textShape = select(g)
.maybeAppend(id, 'html', className)
.maybeAppend('html', 'html', className)
.style('zIndex', 0)
.style('innerHTML', innerHTML)
.call(applyStyle, {
Expand Down

0 comments on commit 18e6626

Please sign in to comment.