]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: camelcase the event names of the Dropdown Menu
authorDaniel Ruf <daniel.ruf@ueberbit.de>
Wed, 21 Feb 2018 09:30:01 +0000 (10:30 +0100)
committerDaniel Ruf <daniel.ruf@ueberbit.de>
Wed, 21 Feb 2018 09:30:01 +0000 (10:30 +0100)
js/foundation.dropdownMenu.js

index 573116140b7aedb6b2b75ef839b961d7f97a1981..917ce29b0cfb803a312f443c52eb0f5240ac2c30 100644 (file)
@@ -10,7 +10,7 @@ import { Plugin } from './foundation.plugin';
 
 /**
  * DropdownMenu module.
- * @module foundation.dropdown-menu
+ * @module foundation.dropdownMenu
  * @requires foundation.util.keyboard
  * @requires foundation.util.box
  * @requires foundation.util.nest
@@ -120,12 +120,12 @@ class DropdownMenu extends Plugin {
     };
 
     if (this.options.clickOpen || hasTouch) {
-      this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', handleClickFn);
+      this.$menuItems.on('click.zf.dropdownMenu touchstart.zf.dropdownMenu', handleClickFn);
     }
 
     // Handle Leaf element Clicks
     if(_this.options.closeOnClickInside){
-      this.$menuItems.on('click.zf.dropdownmenu', function(e) {
+      this.$menuItems.on('click.zf.dropdownMenu', function(e) {
         var $elem = $(this),
             hasSub = $elem.hasClass(parClass);
         if(!hasSub){
@@ -135,7 +135,7 @@ class DropdownMenu extends Plugin {
     }
 
     if (!this.options.disableHover) {
-      this.$menuItems.on('mouseenter.zf.dropdownmenu', function(e) {
+      this.$menuItems.on('mouseenter.zf.dropdownMenu', function(e) {
         var $elem = $(this),
             hasSub = $elem.hasClass(parClass);
 
@@ -145,7 +145,7 @@ class DropdownMenu extends Plugin {
             _this._show($elem.children('.is-dropdown-submenu'));
           }, _this.options.hoverDelay));
         }
-      }).on('mouseleave.zf.dropdownmenu', function(e) {
+      }).on('mouseleave.zf.dropdownMenu', function(e) {
         var $elem = $(this),
             hasSub = $elem.hasClass(parClass);
         if (hasSub && _this.options.autoclose) {
@@ -158,7 +158,7 @@ class DropdownMenu extends Plugin {
         }
       });
     }
-    this.$menuItems.on('keydown.zf.dropdownmenu', function(e) {
+    this.$menuItems.on('keydown.zf.dropdownMenu', function(e) {
       var $element = $(e.target).parentsUntil('ul', '[role="menuitem"]'),
           isTab = _this.$tabs.index($element) > -1,
           $elements = isTab ? _this.$tabs : $element.siblings('li').add($element),
@@ -270,13 +270,13 @@ class DropdownMenu extends Plugin {
   _addBodyHandler() {
     var $body = $(document.body),
         _this = this;
-    $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu')
-         .on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function(e) {
+    $body.off('mouseup.zf.dropdownMenu touchend.zf.dropdownMenu')
+         .on('mouseup.zf.dropdownMenu touchend.zf.dropdownMenu', function(e) {
            var $link = _this.$element.find(e.target);
            if ($link.length) { return; }
 
            _this._hide();
-           $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu');
+           $body.off('mouseup.zf.dropdownMenu touchend.zf.dropdownMenu');
          });
   }
 
@@ -312,7 +312,7 @@ class DropdownMenu extends Plugin {
      * Fires when the new dropdown pane is visible.
      * @event DropdownMenu#show
      */
-    this.$element.trigger('show.zf.dropdownmenu', [$sub]);
+    this.$element.trigger('show.zf.dropdownMenu', [$sub]);
   }
 
   /**
@@ -354,7 +354,7 @@ class DropdownMenu extends Plugin {
        * Fires when the open menus are closed.
        * @event DropdownMenu#hide
        */
-      this.$element.trigger('hide.zf.dropdownmenu', [$toClose]);
+      this.$element.trigger('hide.zf.dropdownMenu', [$toClose]);
     }
   }
 
@@ -363,9 +363,9 @@ class DropdownMenu extends Plugin {
    * @function
    */
   _destroy() {
-    this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click')
+    this.$menuItems.off('.zf.dropdownMenu').removeAttr('data-is-click')
         .removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner');
-    $(document.body).off('.zf.dropdownmenu');
+    $(document.body).off('.zf.dropdownMenu');
     Nest.Burn(this.$element, 'dropdown');
   }
 }