浏览代码

Fix event dispatching on treeview

Diego Smania 3 月之前
父节点
当前提交
b705a20f2c
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      src/ts/treeview.ts

+ 2 - 4
src/ts/treeview.ts

@@ -78,9 +78,8 @@ class Treeview {
     if (childElement) {
       this._element.classList.add(CLASS_NAME_MENU_OPEN)
       slideDown(childElement, this._config.animationSpeed)
+      this._element.dispatchEvent(event)
     }
-
-    this._element.dispatchEvent(event)
   }
 
   close(): void {
@@ -90,9 +89,8 @@ class Treeview {
     if (childElement) {
       this._element.classList.remove(CLASS_NAME_MENU_OPEN)
       slideUp(childElement, this._config.animationSpeed)
+      this._element.dispatchEvent(event)
     }
-
-    this._element.dispatchEvent(event)
   }
 
   toggle(): void {