Proper prototype creation
authorMarcel Werk <burntime@woltlab.com>
Sat, 7 May 2022 17:11:55 +0000 (19:11 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sat, 7 May 2022 17:11:55 +0000 (19:11 +0200)
ts/WoltLabSuite/Core/Ui/Search/Extended.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Extended.js

index 1494a01a88694b2c7d282f6a82da0dfd1d081d88..0156b5c8bb5a108bb027ffb8e3d5d8b60597a14a 100644 (file)
@@ -42,12 +42,12 @@ export class UiSearchExtended {
   private readonly queryInput: HTMLInputElement;
   private readonly typeInput: HTMLSelectElement;
   private readonly usernameInput: HTMLInputElement;
-  private searchID: number | undefined;
+  private readonly delimiter: HTMLDivElement;
+  private searchID: number | undefined = undefined;
   private pages = 0;
   private activePage = 1;
   private lastSearchRequest: AbortController | undefined = undefined;
   private lastSearchResultRequest: AbortController | undefined = undefined;
-  private delimiter: HTMLDivElement;
   private searchParameters: SearchParameters = [];
 
   constructor() {
@@ -55,18 +55,14 @@ export class UiSearchExtended {
     this.queryInput = document.getElementById("searchQuery") as HTMLInputElement;
     this.typeInput = document.getElementById("searchType") as HTMLSelectElement;
     this.usernameInput = document.getElementById("searchAuthor") as HTMLInputElement;
+    this.delimiter = document.createElement("div");
 
-    this.initDelimiter();
+    this.form.insertAdjacentElement("afterend", this.delimiter);
     this.initEventListener();
     this.initKeywordSuggestions();
     this.initQueryString();
   }
 
-  private initDelimiter(): void {
-    this.delimiter = document.createElement("div");
-    this.form.insertAdjacentElement("afterend", this.delimiter);
-  }
-
   private initEventListener(): void {
     this.form.addEventListener("submit", (event) => {
       event.preventDefault();
index 03528c0891cc59d156abcf3def7ebb53210743f4..76e9b8d7ece82dd86706e852476790a78f710b66 100644 (file)
@@ -18,6 +18,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Date/Picker", "../..
     UiScroll = tslib_1.__importStar(UiScroll);
     class UiSearchExtended {
         constructor() {
+            this.searchID = undefined;
             this.pages = 0;
             this.activePage = 1;
             this.lastSearchRequest = undefined;
@@ -27,15 +28,12 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Date/Picker", "../..
             this.queryInput = document.getElementById("searchQuery");
             this.typeInput = document.getElementById("searchType");
             this.usernameInput = document.getElementById("searchAuthor");
-            this.initDelimiter();
+            this.delimiter = document.createElement("div");
+            this.form.insertAdjacentElement("afterend", this.delimiter);
             this.initEventListener();
             this.initKeywordSuggestions();
             this.initQueryString();
         }
-        initDelimiter() {
-            this.delimiter = document.createElement("div");
-            this.form.insertAdjacentElement("afterend", this.delimiter);
-        }
         initEventListener() {
             this.form.addEventListener("submit", (event) => {
                 event.preventDefault();