Do not use .bind() in Date/Picker.ts
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 11 Mar 2021 09:51:18 +0000 (10:51 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 11 Mar 2021 09:51:18 +0000 (10:51 +0100)
ts/WoltLabSuite/Core/Date/Picker.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Date/Picker.js

index bfb1ca2f7acdd31d1b3ca1bd0db90b2cec63335f..b593e9c16c74c70cfe7710bed191c554ab940514 100644 (file)
@@ -794,7 +794,7 @@ const DatePicker = {
           if (!disableClear) {
             const button = document.createElement("a");
             button.className = "inputSuffix button";
-            button.addEventListener("click", this.clear.bind(this, element));
+            button.addEventListener("click", () => this.clear(element));
             if (isEmpty) {
               button.style.setProperty("visibility", "hidden", "");
             }
index 4b81eed9933f2d66ce5ac837ab067a18aea7fd12..2e09cb51337f19e670edbc37e36a8065baabc689 100644 (file)
@@ -661,7 +661,7 @@ define(["require", "exports", "tslib", "../Core", "./Util", "../Dom/Change/Liste
                     if (!disableClear) {
                         const button = document.createElement("a");
                         button.className = "inputSuffix button";
-                        button.addEventListener("click", this.clear.bind(this, element));
+                        button.addEventListener("click", () => this.clear(element));
                         if (isEmpty) {
                             button.style.setProperty("visibility", "hidden", "");
                         }