diff options
| author | Mark Otto <[email protected]> | 2016-06-12 21:17:14 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2016-06-12 21:17:14 -0700 |
| commit | aaad85bc306ccf35bd749ea43d2aa768e4ebabeb (patch) | |
| tree | 8011d6e04d1bb4c87356036eba55cc13639bc96a /docs/dist/js/bootstrap.js | |
| parent | 8feae9075ae55be4e6cd0e884fbfa006a6639ceb (diff) | |
| parent | ce2e944aa6957528f23f1f7e680ac0cb4a75dcac (diff) | |
| download | bootstrap-aaad85bc306ccf35bd749ea43d2aa768e4ebabeb.tar.xz bootstrap-aaad85bc306ccf35bd749ea43d2aa768e4ebabeb.zip | |
Merge branch 'v4-dev' of https://github.com/twbs/bootstrap into v4-dev
Diffstat (limited to 'docs/dist/js/bootstrap.js')
| -rw-r--r-- | docs/dist/js/bootstrap.js | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/docs/dist/js/bootstrap.js b/docs/dist/js/bootstrap.js index e335cb484..ae6e2a7e2 100644 --- a/docs/dist/js/bootstrap.js +++ b/docs/dist/js/bootstrap.js @@ -1,6 +1,6 @@ /*! * Bootstrap v4.0.0-alpha.2 (http://getbootstrap.com) - * Copyright 2011-2016 Twitter, Inc. + * Copyright 2011-2016 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ @@ -45,6 +45,8 @@ var Util = (function ($) { var transition = false; + var MAX_UID = 1000000; + var TransitionEndEvent = { WebkitTransition: 'webkitTransitionEnd', MozTransition: 'transitionend', @@ -67,8 +69,9 @@ var Util = (function ($) { delegateType: transition.end, handle: function handle(event) { if ($(event.target).is(this)) { - return event.handleObj.handler.apply(this, arguments); + return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params } + return undefined; } }; } @@ -130,7 +133,7 @@ var Util = (function ($) { getUID: function getUID(prefix) { do { /* eslint-disable no-bitwise */ - prefix += ~ ~(Math.random() * 1000000); // "~~" acts like a faster Math.floor() here + prefix += ~ ~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here /* eslint-enable no-bitwise */ } while (document.getElementById(prefix)); return prefix; @@ -561,6 +564,8 @@ var Carousel = (function ($) { var DATA_API_KEY = '.data-api'; var JQUERY_NO_CONFLICT = $.fn[NAME]; var TRANSITION_DURATION = 600; + var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key + var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key var Default = { interval: 5000, @@ -776,10 +781,12 @@ var Carousel = (function ($) { } switch (event.which) { - case 37: - this.prev();break; - case 39: - this.next();break; + case ARROW_LEFT_KEYCODE: + this.prev(); + break; + case ARROW_RIGHT_KEYCODE: + this.next(); + break; default: return; } @@ -1390,6 +1397,10 @@ var Dropdown = (function ($) { var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; var JQUERY_NO_CONFLICT = $.fn[NAME]; + var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key + var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key + var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key + var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) var Event = { HIDE: 'hide' + EVENT_KEY, @@ -1524,7 +1535,7 @@ var Dropdown = (function ($) { }, { key: '_clearMenus', value: function _clearMenus(event) { - if (event && event.which === 3) { + if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) { return; } @@ -1587,9 +1598,9 @@ var Dropdown = (function ($) { var parent = Dropdown._getParentFromElement(this); var isActive = $(parent).hasClass(ClassName.OPEN); - if (!isActive && event.which !== 27 || isActive && event.which === 27) { + if (!isActive && event.which !== ESCAPE_KEYCODE || isActive && event.which === ESCAPE_KEYCODE) { - if (event.which === 27) { + if (event.which === ESCAPE_KEYCODE) { var toggle = $(parent).find(Selector.DATA_TOGGLE)[0]; $(toggle).trigger('focus'); } @@ -1610,12 +1621,12 @@ var Dropdown = (function ($) { var index = items.indexOf(event.target); - if (event.which === 38 && index > 0) { + if (event.which === ARROW_UP_KEYCODE && index > 0) { // up index--; } - if (event.which === 40 && index < items.length - 1) { + if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { // down index++; } @@ -1679,6 +1690,7 @@ var Modal = (function ($) { var JQUERY_NO_CONFLICT = $.fn[NAME]; var TRANSITION_DURATION = 300; var BACKDROP_TRANSITION_DURATION = 150; + var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key var Default = { backdrop: true, @@ -1874,6 +1886,7 @@ var Modal = (function ($) { } this._element.style.display = 'block'; + this._element.removeAttribute('aria-hidden'); this._element.scrollTop = 0; if (transition) { @@ -1922,7 +1935,7 @@ var Modal = (function ($) { if (this._isShown && this._config.keyboard) { $(this._element).on(Event.KEYDOWN_DISMISS, function (event) { - if (event.which === 27) { + if (event.which === ESCAPE_KEYCODE) { _this10.hide(); } }); @@ -1945,6 +1958,7 @@ var Modal = (function ($) { var _this11 = this; this._element.style.display = 'none'; + this._element.setAttribute('aria-hidden', 'true'); this._showBackdrop(function () { $(document.body).removeClass(ClassName.OPEN); _this11._resetAdjustments(); @@ -2050,7 +2064,7 @@ var Modal = (function ($) { } if (this._isBodyOverflowing && !isModalOverflowing) { - this._element.style.paddingRight = this._scrollbarWidth + 'px~'; + this._element.style.paddingRight = this._scrollbarWidth + 'px'; } } }, { @@ -2311,6 +2325,7 @@ var ScrollSpy = (function ($) { // todo (fat): remove sketch reliance on jQuery position/offset return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; } + return null; }).filter(function (item) { return item; }).sort(function (a, b) { |
