From 14d1912115c40c3c905b9a077732c526e0a15ffd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 9 Mar 2017 22:04:17 +0100 Subject: upgrade bs to latest git and some more progress --- library/bootstrap/js/bootstrap.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'library/bootstrap/js/bootstrap.js') diff --git a/library/bootstrap/js/bootstrap.js b/library/bootstrap/js/bootstrap.js index 256877332..ee87b9f88 100644 --- a/library/bootstrap/js/bootstrap.js +++ b/library/bootstrap/js/bootstrap.js @@ -645,7 +645,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) { @@ -701,7 +701,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]); }; @@ -772,7 +772,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; @@ -781,7 +781,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]; @@ -1374,9 +1374,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, @@ -1549,7 +1551,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; } -- cgit v1.2.3