Skip to content

Commit

Permalink
fix: replaceChildren compatible with lower versions
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfu1 committed Aug 5, 2024
1 parent 96e2066 commit 83e6bf7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/component",
"version": "2.0.2",
"version": "2.0.3",
"description": "Visualization components for AntV, based on G.",
"license": "MIT",
"main": "lib/index.js",
Expand Down
9 changes: 8 additions & 1 deletion src/ui/tooltip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ export class Tooltip extends Component<TooltipStyleProps> {
const { content } = this.attributes;
if (!content) return;
if (typeof content === 'string') this.element.innerHTML = content;
else this.element.replaceChildren(content);
else {
const el = this.element;
if (el.replaceChildren) el.replaceChildren(content);
else {
el.innerHTML = '';
el.append(content);
}
}
}

/**
Expand Down

0 comments on commit 83e6bf7

Please sign in to comment.