mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 16:44:17 +02:00
Merge branch 'twbs/v4-dev' into dropdown-keyboard
This commit is contained in:
8
js/dist/carousel.js
vendored
8
js/dist/carousel.js
vendored
@@ -129,7 +129,7 @@ var Carousel = function ($) {
|
||||
if (this._isSliding) {
|
||||
throw new Error('Carousel is sliding');
|
||||
}
|
||||
this._slide(Direction.PREVIOUS);
|
||||
this._slide(Direction.PREV);
|
||||
};
|
||||
|
||||
Carousel.prototype.pause = function pause(event) {
|
||||
@@ -185,7 +185,7 @@ var Carousel = function ($) {
|
||||
return;
|
||||
}
|
||||
|
||||
var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
|
||||
var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
|
||||
|
||||
this._slide(direction, this._items[index]);
|
||||
};
|
||||
@@ -256,7 +256,7 @@ var Carousel = function ($) {
|
||||
|
||||
Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) {
|
||||
var isNextDirection = direction === Direction.NEXT;
|
||||
var isPrevDirection = direction === Direction.PREVIOUS;
|
||||
var isPrevDirection = direction === Direction.PREV;
|
||||
var activeIndex = this._getItemIndex(activeElement);
|
||||
var lastItemIndex = this._items.length - 1;
|
||||
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
|
||||
@@ -265,7 +265,7 @@ var Carousel = function ($) {
|
||||
return activeElement;
|
||||
}
|
||||
|
||||
var delta = direction === Direction.PREVIOUS ? -1 : 1;
|
||||
var delta = direction === Direction.PREV ? -1 : 1;
|
||||
var itemIndex = (activeIndex + delta) % this._items.length;
|
||||
|
||||
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
||||
|
2
js/dist/carousel.js.map
vendored
2
js/dist/carousel.js.map
vendored
File diff suppressed because one or more lines are too long
4
js/dist/dropdown.js
vendored
4
js/dist/dropdown.js
vendored
@@ -24,9 +24,11 @@ var Dropdown = function ($) {
|
||||
var DATA_API_KEY = '.data-api';
|
||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
||||
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space 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 REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + '|' + ARROW_DOWN_KEYCODE + '|' + ESCAPE_KEYCODE + '|' + SPACE_KEYCODE);
|
||||
|
||||
var Event = {
|
||||
HIDE: 'hide' + EVENT_KEY,
|
||||
@@ -199,7 +201,7 @@ var Dropdown = function ($) {
|
||||
};
|
||||
|
||||
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
|
||||
if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
|
||||
if (!REGEXP_KEYDOWN.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
2
js/dist/dropdown.js.map
vendored
2
js/dist/dropdown.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user