Commit 27cf3d67 authored by Pierre-Denis Vanduynslager's avatar Pierre-Denis Vanduynslager
Browse files

Merge remote-tracking branch 'twbs/v4-dev' into v4-dev

parents f0c0a753 8e4f3fe7
Showing with 61 additions and 44 deletions
+61 -44
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -10,7 +10,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function' ...@@ -10,7 +10,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): popover.js * Bootstrap (v4.0.0-alpha.3): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -24,7 +24,7 @@ var Popover = (function ($) { ...@@ -24,7 +24,7 @@ var Popover = (function ($) {
*/ */
var NAME = 'popover'; var NAME = 'popover';
var VERSION = '4.0.0-alpha.2'; var VERSION = '4.0.0-alpha.3';
var DATA_KEY = 'bs.popover'; var DATA_KEY = 'bs.popover';
var EVENT_KEY = '.' + DATA_KEY; var EVENT_KEY = '.' + DATA_KEY;
var JQUERY_NO_CONFLICT = $.fn[NAME]; var JQUERY_NO_CONFLICT = $.fn[NAME];
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -6,7 +6,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons ...@@ -6,7 +6,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): scrollspy.js * Bootstrap (v4.0.0-alpha.3): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -20,7 +20,7 @@ var ScrollSpy = (function ($) { ...@@ -20,7 +20,7 @@ var ScrollSpy = (function ($) {
*/ */
var NAME = 'scrollspy'; var NAME = 'scrollspy';
var VERSION = '4.0.0-alpha.2'; var VERSION = '4.0.0-alpha.3';
var DATA_KEY = 'bs.scrollspy'; var DATA_KEY = 'bs.scrollspy';
var EVENT_KEY = '.' + DATA_KEY; var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api'; var DATA_API_KEY = '.data-api';
...@@ -135,6 +135,7 @@ var ScrollSpy = (function ($) { ...@@ -135,6 +135,7 @@ var ScrollSpy = (function ($) {
// todo (fat): remove sketch reliance on jQuery position/offset // todo (fat): remove sketch reliance on jQuery position/offset
return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
} }
return null;
}).filter(function (item) { }).filter(function (item) {
return item; return item;
}).sort(function (a, b) { }).sort(function (a, b) {
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -6,7 +6,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons ...@@ -6,7 +6,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): tab.js * Bootstrap (v4.0.0-alpha.3): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -20,7 +20,7 @@ var Tab = (function ($) { ...@@ -20,7 +20,7 @@ var Tab = (function ($) {
*/ */
var NAME = 'tab'; var NAME = 'tab';
var VERSION = '4.0.0-alpha.2'; var VERSION = '4.0.0-alpha.3';
var DATA_KEY = 'bs.tab'; var DATA_KEY = 'bs.tab';
var EVENT_KEY = '.' + DATA_KEY; var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api'; var DATA_API_KEY = '.data-api';
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -8,7 +8,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons ...@@ -8,7 +8,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): tooltip.js * Bootstrap (v4.0.0-alpha.3): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -30,7 +30,7 @@ var Tooltip = (function ($) { ...@@ -30,7 +30,7 @@ var Tooltip = (function ($) {
*/ */
var NAME = 'tooltip'; var NAME = 'tooltip';
var VERSION = '4.0.0-alpha.2'; var VERSION = '4.0.0-alpha.3';
var DATA_KEY = 'bs.tooltip'; var DATA_KEY = 'bs.tooltip';
var EVENT_KEY = '.' + DATA_KEY; var EVENT_KEY = '.' + DATA_KEY;
var JQUERY_NO_CONFLICT = $.fn[NAME]; var JQUERY_NO_CONFLICT = $.fn[NAME];
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): util.js * Bootstrap (v4.0.0-alpha.3): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -17,6 +17,8 @@ var Util = (function ($) { ...@@ -17,6 +17,8 @@ var Util = (function ($) {
var transition = false; var transition = false;
var MAX_UID = 1000000;
var TransitionEndEvent = { var TransitionEndEvent = {
WebkitTransition: 'webkitTransitionEnd', WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend', MozTransition: 'transitionend',
...@@ -39,8 +41,9 @@ var Util = (function ($) { ...@@ -39,8 +41,9 @@ var Util = (function ($) {
delegateType: transition.end, delegateType: transition.end,
handle: function handle(event) { handle: function handle(event) {
if ($(event.target).is(this)) { 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 ($) { ...@@ -102,7 +105,7 @@ var Util = (function ($) {
getUID: function getUID(prefix) { getUID: function getUID(prefix) {
do { do {
/* eslint-disable no-bitwise */ /* 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 */ /* eslint-enable no-bitwise */
} while (document.getElementById(prefix)); } while (document.getElementById(prefix));
return prefix; return prefix;
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -3,7 +3,7 @@ import Util from './util' ...@@ -3,7 +3,7 @@ import Util from './util'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): alert.js * Bootstrap (v4.0.0-alpha.3): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -18,7 +18,7 @@ const Alert = (($) => { ...@@ -18,7 +18,7 @@ const Alert = (($) => {
*/ */
const NAME = 'alert' const NAME = 'alert'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.alert' const DATA_KEY = 'bs.alert'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
......
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): button.js * Bootstrap (v4.0.0-alpha.3): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -15,7 +15,7 @@ const Button = (($) => { ...@@ -15,7 +15,7 @@ const Button = (($) => {
*/ */
const NAME = 'button' const NAME = 'button'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.button' const DATA_KEY = 'bs.button'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
......
...@@ -3,7 +3,7 @@ import Util from './util' ...@@ -3,7 +3,7 @@ import Util from './util'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): carousel.js * Bootstrap (v4.0.0-alpha.3): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -18,12 +18,14 @@ const Carousel = (($) => { ...@@ -18,12 +18,14 @@ const Carousel = (($) => {
*/ */
const NAME = 'carousel' const NAME = 'carousel'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.carousel' const DATA_KEY = 'bs.carousel'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME] const JQUERY_NO_CONFLICT = $.fn[NAME]
const TRANSITION_DURATION = 600 const TRANSITION_DURATION = 600
const ARROW_LEFT_KEYCODE = 37 // KeyboardEvent.which value for left arrow key
const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key
const Default = { const Default = {
interval : 5000, interval : 5000,
...@@ -236,9 +238,14 @@ const Carousel = (($) => { ...@@ -236,9 +238,14 @@ const Carousel = (($) => {
} }
switch (event.which) { switch (event.which) {
case 37: this.prev(); break case ARROW_LEFT_KEYCODE:
case 39: this.next(); break this.prev()
default: return break
case ARROW_RIGHT_KEYCODE:
this.next()
break
default:
return
} }
} }
......
...@@ -3,7 +3,7 @@ import Util from './util' ...@@ -3,7 +3,7 @@ import Util from './util'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): collapse.js * Bootstrap (v4.0.0-alpha.3): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -18,7 +18,7 @@ const Collapse = (($) => { ...@@ -18,7 +18,7 @@ const Collapse = (($) => {
*/ */
const NAME = 'collapse' const NAME = 'collapse'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.collapse' const DATA_KEY = 'bs.collapse'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
......
...@@ -3,7 +3,7 @@ import Util from './util' ...@@ -3,7 +3,7 @@ import Util from './util'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): dropdown.js * Bootstrap (v4.0.0-alpha.3): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -17,12 +17,16 @@ const Dropdown = (($) => { ...@@ -17,12 +17,16 @@ const Dropdown = (($) => {
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const NAME = 'dropdown' const NAME = 'dropdown'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.dropdown' const DATA_KEY = 'bs.dropdown'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME] const JQUERY_NO_CONFLICT = $.fn[NAME]
const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key
const ARROW_UP_KEYCODE = 38 // KeyboardEvent.which value for up arrow key
const ARROW_DOWN_KEYCODE = 40 // KeyboardEvent.which value for down arrow key
const RIGHT_MOUSE_BUTTON_WHICH = 3 // MouseEvent.which value for the right button (assuming a right-handed mouse)
const Event = { const Event = {
HIDE : `hide${EVENT_KEY}`, HIDE : `hide${EVENT_KEY}`,
...@@ -152,7 +156,7 @@ const Dropdown = (($) => { ...@@ -152,7 +156,7 @@ const Dropdown = (($) => {
} }
static _clearMenus(event) { static _clearMenus(event) {
if (event && event.which === 3) { if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) {
return return
} }
...@@ -218,10 +222,10 @@ const Dropdown = (($) => { ...@@ -218,10 +222,10 @@ const Dropdown = (($) => {
let parent = Dropdown._getParentFromElement(this) let parent = Dropdown._getParentFromElement(this)
let isActive = $(parent).hasClass(ClassName.OPEN) let isActive = $(parent).hasClass(ClassName.OPEN)
if ((!isActive && event.which !== 27) || if ((!isActive && event.which !== ESCAPE_KEYCODE) ||
(isActive && event.which === 27)) { (isActive && event.which === ESCAPE_KEYCODE)) {
if (event.which === 27) { if (event.which === ESCAPE_KEYCODE) {
let toggle = $(parent).find(Selector.DATA_TOGGLE)[0] let toggle = $(parent).find(Selector.DATA_TOGGLE)[0]
$(toggle).trigger('focus') $(toggle).trigger('focus')
} }
...@@ -242,11 +246,11 @@ const Dropdown = (($) => { ...@@ -242,11 +246,11 @@ const Dropdown = (($) => {
let index = items.indexOf(event.target) let index = items.indexOf(event.target)
if (event.which === 38 && index > 0) { // up if (event.which === ARROW_UP_KEYCODE && index > 0) { // up
index-- index--
} }
if (event.which === 40 && index < items.length - 1) { // down if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { // down
index++ index++
} }
......
...@@ -3,7 +3,7 @@ import Util from './util' ...@@ -3,7 +3,7 @@ import Util from './util'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): modal.js * Bootstrap (v4.0.0-alpha.3): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -18,13 +18,14 @@ const Modal = (($) => { ...@@ -18,13 +18,14 @@ const Modal = (($) => {
*/ */
const NAME = 'modal' const NAME = 'modal'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.modal' const DATA_KEY = 'bs.modal'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME] const JQUERY_NO_CONFLICT = $.fn[NAME]
const TRANSITION_DURATION = 300 const TRANSITION_DURATION = 300
const BACKDROP_TRANSITION_DURATION = 150 const BACKDROP_TRANSITION_DURATION = 150
const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key
const Default = { const Default = {
backdrop : true, backdrop : true,
...@@ -271,7 +272,7 @@ const Modal = (($) => { ...@@ -271,7 +272,7 @@ const Modal = (($) => {
_setEscapeEvent() { _setEscapeEvent() {
if (this._isShown && this._config.keyboard) { if (this._isShown && this._config.keyboard) {
$(this._element).on(Event.KEYDOWN_DISMISS, (event) => { $(this._element).on(Event.KEYDOWN_DISMISS, (event) => {
if (event.which === 27) { if (event.which === ESCAPE_KEYCODE) {
this.hide() this.hide()
} }
}) })
......
...@@ -3,7 +3,7 @@ import Tooltip from './tooltip' ...@@ -3,7 +3,7 @@ import Tooltip from './tooltip'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): popover.js * Bootstrap (v4.0.0-alpha.3): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -18,7 +18,7 @@ const Popover = (($) => { ...@@ -18,7 +18,7 @@ const Popover = (($) => {
*/ */
const NAME = 'popover' const NAME = 'popover'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.popover' const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME] const JQUERY_NO_CONFLICT = $.fn[NAME]
......
...@@ -3,7 +3,7 @@ import Util from './util' ...@@ -3,7 +3,7 @@ import Util from './util'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): scrollspy.js * Bootstrap (v4.0.0-alpha.3): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -18,7 +18,7 @@ const ScrollSpy = (($) => { ...@@ -18,7 +18,7 @@ const ScrollSpy = (($) => {
*/ */
const NAME = 'scrollspy' const NAME = 'scrollspy'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.scrollspy' const DATA_KEY = 'bs.scrollspy'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
...@@ -140,6 +140,7 @@ const ScrollSpy = (($) => { ...@@ -140,6 +140,7 @@ const ScrollSpy = (($) => {
targetSelector targetSelector
] ]
} }
return null
}) })
.filter((item) => item) .filter((item) => item)
.sort((a, b) => a[0] - b[0]) .sort((a, b) => a[0] - b[0])
......
...@@ -3,7 +3,7 @@ import Util from './util' ...@@ -3,7 +3,7 @@ import Util from './util'
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): tab.js * Bootstrap (v4.0.0-alpha.3): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -18,7 +18,7 @@ const Tab = (($) => { ...@@ -18,7 +18,7 @@ const Tab = (($) => {
*/ */
const NAME = 'tab' const NAME = 'tab'
const VERSION = '4.0.0-alpha.2' const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.tab' const DATA_KEY = 'bs.tab'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment