You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2020/01/29 09:03:57 UTC

[myfaces-tobago] branch master updated: tobago-dropdown: custom elements

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new 853e7f8  tobago-dropdown: custom elements
853e7f8 is described below

commit 853e7f8f87ef82b711ab7b5c52c83ef5775cde4e
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Jan 29 10:03:41 2020 +0100

    tobago-dropdown: custom elements
    
    * cleanup
    
    issue: TOBAGO-1633: TS refactoring
---
 .../src/main/npm/ts/tobago-dropdown.ts                   | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-dropdown.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-dropdown.ts
index f6de568..61e0898 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-dropdown.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-dropdown.ts
@@ -19,28 +19,20 @@ import Popper from "popper.js";
 
 class Dropdown extends HTMLElement {
 
-  private _deselectComponent = this.deselectComponent.bind(this);
-  private _toggleDropdown = this.toggleDropdown.bind(this);
-  private _setCloseFlag = this.setCloseFlag.bind(this);
   private closeFlag: boolean = false;
 
   constructor() {
     super();
+
+    this.toggleButton.addEventListener("mouseup", this.toggleDropdown.bind(this));
+    this.toggleButton.addEventListener("blur", this.setCloseFlag.bind(this));
+    window.addEventListener("mouseup", this.deselectComponent.bind(this));
   }
 
   connectedCallback(): void {
-    this.toggleButton.addEventListener("mouseup", this._toggleDropdown);
-    this.toggleButton.addEventListener("blur", this._setCloseFlag);
-    window.addEventListener("mouseup", this._deselectComponent);
     //TODO add keyboard support
   }
 
-  disconnectedCallback(): void {
-    this.toggleButton.removeEventListener("mouseup", this._toggleDropdown);
-    this.toggleButton.removeEventListener("blur", this._setCloseFlag);
-    window.removeEventListener("mouseup", this._deselectComponent);
-  }
-
   toggleDropdown(event: Event): void {
     this.resetCloseFlag();