Use `WeakSet` to track elements
authorAlexander Ebert <ebert@woltlab.com>
Fri, 6 Nov 2020 16:44:33 +0000 (17:44 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 6 Nov 2020 16:44:33 +0000 (17:44 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Edit.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Response/Edit.js
wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Comment/Edit.ts
wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Comment/Response/Edit.ts

index 74f0e07d8f02d8c24a4e96b7d7523a42265c1188..3b067686dce3d51f2a92b48496fabdbffdfafb40 100644 (file)
@@ -23,7 +23,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Dom/Ch
          */
         constructor(container) {
             this._activeElement = null;
-            this._comments = new Set();
+            this._comments = new WeakSet();
             this._editorContainer = null;
             this._container = container;
             this.rebuild();
index c65c8fa963d30e911113eb5dc45ca1014490956c..3092a373ad554e1fc43042372cd5152520cf15b2 100644 (file)
@@ -22,7 +22,7 @@ define(["require", "exports", "tslib", "../../../Ajax", "../../../Core", "../../
          */
         constructor(container) {
             super(container);
-            this._responses = new Set();
+            this._responses = new WeakSet();
             this.rebuildResponses();
             Listener_1.default.add("Ui/Comment/Response/Edit_" + Util_1.default.identify(this._container), () => this.rebuildResponses());
         }
index 662333b38e95aaca03c35f4db186fa65d71e0558..4646f8aad7e0f15ddbea571a4b8b40f2df1bfb08 100644 (file)
@@ -29,7 +29,7 @@ interface AjaxResponse {
 
 class UiCommentEdit {
   protected _activeElement: HTMLElement | null = null;
-  protected readonly _comments = new Set<HTMLElement>();
+  protected readonly _comments = new WeakSet<HTMLElement>();
   protected readonly _container: HTMLElement;
   protected _editorContainer: HTMLElement | null = null;
 
index f28f11ef166879e3685a1ce46164a2e3d539955a..95d5b3768f404254e8753154ac7415d79388fb92 100644 (file)
@@ -24,7 +24,7 @@ interface AjaxResponse {
 }
 
 class UiCommentResponseEdit extends UiCommentEdit {
-  protected readonly _responses = new Set<HTMLElement>();
+  protected readonly _responses = new WeakSet<HTMLElement>();
 
   /**
    * Initializes the comment edit manager.