Skip to content

Commit

Permalink
AG-11385 Remove HTMLElements from the DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
olegat committed May 15, 2024
1 parent 36a0753 commit b9f5260
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/ag-charts-community/src/chart/legend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export class Legend extends BaseProperties {
this.destroyFns.forEach((f) => f());

this.pagination.destroy();
this.itemSelection.clear();
}

public onMarkerShapeChange() {
Expand Down
5 changes: 5 additions & 0 deletions packages/ag-charts-community/src/chart/markerLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export class MarkerLabel extends Group {
this.append([this.symbolsGroup, label]);
}

override destroy() {
super.destroy();
this.proxyButton?.remove();
}

proxyButton?: HTMLButtonElement;

@ProxyPropertyOnWrite('label')
Expand Down
4 changes: 4 additions & 0 deletions packages/ag-charts-community/src/scene/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ export abstract class Node extends ChangeDetectable {
this.zIndex = zIndex ?? 0;
}

destroy(): void {
this.parent?.removeChild(this);
}

containsPoint(_x: number, _y: number): boolean {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ag-charts-community/src/scene/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Selection<TChild extends Node = Node, TDatum = any> {
if (this.garbageBin.has(node)) {
this._nodesMap.delete(node);
this.garbageBin.delete(node);
this.parentNode.removeChild(node);
node.destroy();
return false;
}
return true;
Expand Down

0 comments on commit b9f5260

Please sign in to comment.