Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use Element#remove instead of Node#removeChild #347

Open
wants to merge 1 commit into
base: v2-beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/js/charts/AxisChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export default class AxisChart extends BaseChart {
if (this.overlayGuides) {
this.overlayGuides.forEach(g => {
let o = g.overlay;
o.parentNode.removeChild(o);
o.remove();
});
}

Expand Down Expand Up @@ -484,7 +484,7 @@ export default class AxisChart extends BaseChart {
if (this.overlayGuides) {
this.overlayGuides.forEach(g => {
let o = g.overlay;
o.parentNode.removeChild(o);
o.remove();
});
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/js/charts/BaseChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class BaseChart {
this.data = this.realData;
setTimeout(() => { this.update(this.data, true); }, this.initTimeout);
}

if (this.config.showLegend) {
this.renderLegend();
}
Expand All @@ -180,7 +180,7 @@ export default class BaseChart {

makeChartArea() {
if (this.svg) {
this.container.removeChild(this.svg);
this.svg.remove();
}
let m = this.measures;

Expand Down Expand Up @@ -240,7 +240,7 @@ export default class BaseChart {
if (!data) console.error('No data to update.');
if (!drawing) data = deepClone(data);
const animate = drawing ? !this.config.disableEntryAnimation : this.config.animate;

this.data = this.prepareData(data);
this.calc(); // builds state
this.render(this.components, animate);
Expand All @@ -249,7 +249,7 @@ export default class BaseChart {
render(components = this.components, animate = true) {
if (this.config.isNavigable) {
// Remove all existing overlays
this.overlays.map(o => o.parentNode.removeChild(o));
this.overlays.map(o => o.remove());
// ref.parentNode.insertBefore(element, ref);
}
let elementsToAnimate = [];
Expand Down
4 changes: 2 additions & 2 deletions src/js/utils/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ export function runSMILAnimation(parent, svgElement, elementsToAnimate) {

let animSvgElement = animateSVG(svgElement, elementsToAnimate);
if (svgElement.parentNode == parent) {
parent.removeChild(svgElement);
svgElement.remove();
parent.appendChild(animSvgElement);

}

// Replace the new svgElement (data has already been replaced)
setTimeout(() => {
if (animSvgElement.parentNode == parent) {
parent.removeChild(animSvgElement);
animSvgElement.remove();
parent.appendChild(svgElement);
}
}, REPLACE_ALL_NEW_DUR);
Expand Down
2 changes: 1 addition & 1 deletion src/js/utils/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function downloadFile(filename, data) {
document.body.appendChild(a);
a.click();
setTimeout(function () {
document.body.removeChild(a);
a.remove();
window.URL.revokeObjectURL(url);
}, 300);
}
Expand Down