1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-20 04:11:39 +02:00

Merge branch 'v4-dev' of https://github.com/twbs/bootstrap into v4-dev

This commit is contained in:
Mark Otto
2016-06-12 21:17:14 -07:00
61 changed files with 828 additions and 8483 deletions

12
js/dist/carousel.js vendored
View File

@@ -26,6 +26,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,
@@ -241,10 +243,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;
}

File diff suppressed because one or more lines are too long

14
js/dist/dropdown.js vendored
View File

@@ -25,6 +25,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,
@@ -159,7 +163,7 @@ var Dropdown = (function ($) {
}, {
key: '_clearMenus',
value: function _clearMenus(event) {
if (event && event.which === 3) {
if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) {
return;
}
@@ -222,9 +226,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');
}
@@ -245,12 +249,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++;
}

File diff suppressed because one or more lines are too long

7
js/dist/modal.js vendored
View File

@@ -27,6 +27,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,
@@ -222,6 +223,7 @@ var Modal = (function ($) {
}
this._element.style.display = 'block';
this._element.removeAttribute('aria-hidden');
this._element.scrollTop = 0;
if (transition) {
@@ -270,7 +272,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) {
_this4.hide();
}
});
@@ -293,6 +295,7 @@ var Modal = (function ($) {
var _this5 = this;
this._element.style.display = 'none';
this._element.setAttribute('aria-hidden', 'true');
this._showBackdrop(function () {
$(document.body).removeClass(ClassName.OPEN);
_this5._resetAdjustments();
@@ -398,7 +401,7 @@ var Modal = (function ($) {
}
if (this._isBodyOverflowing && !isModalOverflowing) {
this._element.style.paddingRight = this._scrollbarWidth + 'px~';
this._element.style.paddingRight = this._scrollbarWidth + 'px';
}
}
}, {

File diff suppressed because one or more lines are too long

View File

@@ -135,6 +135,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) {

File diff suppressed because one or more lines are too long

7
js/dist/util.js vendored
View File

@@ -17,6 +17,8 @@ var Util = (function ($) {
var transition = false;
var MAX_UID = 1000000;
var TransitionEndEvent = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
@@ -39,8 +41,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;
}
};
}
@@ -102,7 +105,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;

2
js/dist/util.js.map vendored

File diff suppressed because one or more lines are too long