diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2018-01-19 02:02:42 +0300 |
---|---|---|
committer | Gleb Mazovetskiy <glex.spb@gmail.com> | 2018-01-19 02:02:42 +0300 |
commit | bbb8b796ca6225ce90e53665edb4f370535c45a8 (patch) | |
tree | c72b65dc83c43851ea10e158dde77e289d33f73e /assets/javascripts/bootstrap/dropdown.js | |
parent | 176cbf4fbf07e29783b0726f8426da0a7ebe5ead (diff) |
rake update[v4.0.0]
Diffstat (limited to 'assets/javascripts/bootstrap/dropdown.js')
-rw-r--r-- | assets/javascripts/bootstrap/dropdown.js | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/assets/javascripts/bootstrap/dropdown.js b/assets/javascripts/bootstrap/dropdown.js index 5250119..a4f73fe 100644 --- a/assets/javascripts/bootstrap/dropdown.js +++ b/assets/javascripts/bootstrap/dropdown.js @@ -6,7 +6,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-beta.3): dropdown.js + * Bootstrap (v4.0.0): dropdown.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ var Dropdown = function ($) { * ------------------------------------------------------------------------ */ var NAME = 'dropdown'; - var VERSION = '4.0.0-beta.3'; + var VERSION = '4.0.0'; var DATA_KEY = 'bs.dropdown'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -100,12 +100,12 @@ var Dropdown = function ($) { this._inNavbar = this._detectNavbar(); this._addEventListeners(); - } // getters + } // Getters var _proto = Dropdown.prototype; - // public + // Public _proto.toggle = function toggle() { if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) { return; @@ -138,10 +138,10 @@ var Dropdown = function ($) { * Popper - https://popper.js.org */ if (typeof Popper === 'undefined') { - throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)'); + throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)'); } - var element = this._element; // for dropup with alignment we use the parent as popper container + var element = this._element; // For dropup with alignment we use the parent as popper container if ($(parent).hasClass(ClassName.DROPUP)) { if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) { @@ -157,13 +157,13 @@ var Dropdown = function ($) { } this._popper = new Popper(element, this._menu, this._getPopperConfig()); - } // if this is a touch-enabled device we add extra + } // If this is a touch-enabled device we add extra // empty mouseover listeners to the body's immediate children; // only needed because of broken event delegation on iOS // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html - if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) { + if ('ontouchstart' in document.documentElement && $(parent).closest(Selector.NAVBAR_NAV).length === 0) { $('body').children().on('mouseover', null, $.noop); } @@ -194,7 +194,7 @@ var Dropdown = function ($) { if (this._popper !== null) { this._popper.scheduleUpdate(); } - }; // private + }; // Private _proto._addEventListeners = function _addEventListeners() { @@ -276,7 +276,7 @@ var Dropdown = function ($) { } }; return popperConfig; - }; // static + }; // Static Dropdown._jQueryInterface = function _jQueryInterface(config) { @@ -292,7 +292,7 @@ var Dropdown = function ($) { if (typeof config === 'string') { if (typeof data[config] === 'undefined') { - throw new Error("No method named \"" + config + "\""); + throw new TypeError("No method named \"" + config + "\""); } data[config](); @@ -334,7 +334,7 @@ var Dropdown = function ($) { if (hideEvent.isDefaultPrevented()) { continue; - } // if this is a touch-enabled device we remove the extra + } // If this is a touch-enabled device we remove the extra // empty mouseover listeners we added for iOS support @@ -357,7 +357,8 @@ var Dropdown = function ($) { } return parent || element.parentNode; - }; + }; // eslint-disable-next-line complexity + Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { // If not input/textarea: @@ -394,19 +395,19 @@ var Dropdown = function ($) { var items = $(parent).find(Selector.VISIBLE_ITEMS).get(); - if (!items.length) { + if (items.length === 0) { return; } var index = items.indexOf(event.target); if (event.which === ARROW_UP_KEYCODE && index > 0) { - // up + // Up index--; } if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { - // down + // Down index++; } |