mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-21 18:54:30 +01:00
implement global dispose method
This commit is contained in:
parent
dafdd180cd
commit
f8b2569ec8
@ -70,7 +70,7 @@ module.exports = function (grunt) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
babel: {
|
babel: {
|
||||||
src: {
|
dev: {
|
||||||
options: {
|
options: {
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
modules: 'ignore'
|
modules: 'ignore'
|
||||||
@ -352,7 +352,7 @@ module.exports = function (grunt) {
|
|||||||
watch: {
|
watch: {
|
||||||
src: {
|
src: {
|
||||||
files: '<%= jscs.core.src %>',
|
files: '<%= jscs.core.src %>',
|
||||||
tasks: ['qunit', 'concat']
|
tasks: ['babel:dev']
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
files: '<%= jscs.test.src %>',
|
files: '<%= jscs.test.src %>',
|
||||||
|
@ -169,6 +169,8 @@ var Alert = (function ($) {
|
|||||||
var NAME = 'alert';
|
var NAME = 'alert';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.alert';
|
var DATA_KEY = 'bs.alert';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
@ -177,9 +179,9 @@ var Alert = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
CLOSE: 'close.bs.alert',
|
CLOSE: 'close' + EVENT_KEY,
|
||||||
CLOSED: 'closed.bs.alert',
|
CLOSED: 'closed' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.alert.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -218,6 +220,12 @@ var Alert = (function ($) {
|
|||||||
|
|
||||||
this._removeElement(rootElement);
|
this._removeElement(rootElement);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getRootElement',
|
key: '_getRootElement',
|
||||||
|
|
||||||
@ -311,7 +319,7 @@ var Alert = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
@ -347,6 +355,8 @@ var Button = (function ($) {
|
|||||||
var NAME = 'button';
|
var NAME = 'button';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.button';
|
var DATA_KEY = 'bs.button';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
@ -365,8 +375,8 @@ var Button = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
CLICK: 'click.bs.button.data-api',
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
FOCUS_BLUR: 'focus.bs.button.data-api blur.bs.button.data-api'
|
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + '' + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + '' + DATA_API_KEY)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -420,6 +430,12 @@ var Button = (function ($) {
|
|||||||
$(this._element).toggleClass(ClassName.ACTIVE);
|
$(this._element).toggleClass(ClassName.ACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}], [{
|
}], [{
|
||||||
key: 'VERSION',
|
key: 'VERSION',
|
||||||
|
|
||||||
@ -458,7 +474,7 @@ var Button = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE_CARROT, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var button = event.target;
|
var button = event.target;
|
||||||
@ -468,7 +484,7 @@ var Button = (function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button._jQueryInterface.call($(button), 'toggle');
|
Button._jQueryInterface.call($(button), 'toggle');
|
||||||
}).on(Event.FOCUS_BLUR, Selector.DATA_TOGGLE_CARROT, function (event) {
|
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
var button = $(event.target).closest(Selector.BUTTON)[0];
|
var button = $(event.target).closest(Selector.BUTTON)[0];
|
||||||
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
||||||
});
|
});
|
||||||
@ -507,6 +523,8 @@ var Carousel = (function ($) {
|
|||||||
var NAME = 'carousel';
|
var NAME = 'carousel';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.carousel';
|
var DATA_KEY = 'bs.carousel';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 600;
|
var TRANSITION_DURATION = 600;
|
||||||
|
|
||||||
@ -524,10 +542,13 @@ var Carousel = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
SLIDE: 'slide.bs.carousel',
|
SLIDE: 'slide' + EVENT_KEY,
|
||||||
SLID: 'slid.bs.carousel',
|
SLID: 'slid' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.carousel.data-api',
|
KEYDOWN: 'keydown' + EVENT_KEY,
|
||||||
LOAD: 'load'
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
|
||||||
|
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -651,6 +672,21 @@ var Carousel = (function ($) {
|
|||||||
|
|
||||||
this._slide(direction, this._items[index]);
|
this._slide(direction, this._items[index]);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
this._items = null;
|
||||||
|
this._config = null;
|
||||||
|
this._element = null;
|
||||||
|
this._interval = null;
|
||||||
|
this._isPaused = null;
|
||||||
|
this._isSliding = null;
|
||||||
|
this._activeElement = null;
|
||||||
|
this._indicatorsElement = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_addEventListeners',
|
key: '_addEventListeners',
|
||||||
|
|
||||||
@ -658,11 +694,11 @@ var Carousel = (function ($) {
|
|||||||
|
|
||||||
value: function _addEventListeners() {
|
value: function _addEventListeners() {
|
||||||
if (this._config.keyboard) {
|
if (this._config.keyboard) {
|
||||||
$(this._element).on('keydown.bs.carousel', $.proxy(this._keydown, this));
|
$(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.pause == 'hover' && !('ontouchstart' in document.documentElement)) {
|
if (this._config.pause == 'hover' && !('ontouchstart' in document.documentElement)) {
|
||||||
$(this._element).on('mouseenter.bs.carousel', $.proxy(this.pause, this)).on('mouseleave.bs.carousel', $.proxy(this.cycle, this));
|
$(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -889,9 +925,9 @@ var Carousel = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
$(Selector.DATA_RIDE).each(function () {
|
$(Selector.DATA_RIDE).each(function () {
|
||||||
var $carousel = $(this);
|
var $carousel = $(this);
|
||||||
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
||||||
@ -932,6 +968,8 @@ var Collapse = (function ($) {
|
|||||||
var NAME = 'collapse';
|
var NAME = 'collapse';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.collapse';
|
var DATA_KEY = 'bs.collapse';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 600;
|
var TRANSITION_DURATION = 600;
|
||||||
|
|
||||||
@ -941,11 +979,11 @@ var Collapse = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
SHOW: 'show.bs.collapse',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.collapse',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
HIDE: 'hide.bs.collapse',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.collapse',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.collapse.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -1012,8 +1050,8 @@ var Collapse = (function ($) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var activesData = undefined;
|
|
||||||
var actives = undefined;
|
var actives = undefined;
|
||||||
|
var activesData = undefined;
|
||||||
|
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
actives = $.makeArray($(Selector.ACTIVES));
|
actives = $.makeArray($(Selector.ACTIVES));
|
||||||
@ -1126,6 +1164,17 @@ var Collapse = (function ($) {
|
|||||||
value: function setTransitioning(isTransitioning) {
|
value: function setTransitioning(isTransitioning) {
|
||||||
this._isTransitioning = isTransitioning;
|
this._isTransitioning = isTransitioning;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
this._config = null;
|
||||||
|
this._parent = null;
|
||||||
|
this._element = null;
|
||||||
|
this._triggerArray = null;
|
||||||
|
this._isTransitioning = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getDimension',
|
key: '_getDimension',
|
||||||
|
|
||||||
@ -1216,7 +1265,7 @@ var Collapse = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var target = Collapse._getTargetFromElement(this);
|
var target = Collapse._getTargetFromElement(this);
|
||||||
@ -1261,16 +1310,18 @@ var Dropdown = (function ($) {
|
|||||||
var NAME = 'dropdown';
|
var NAME = 'dropdown';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.dropdown';
|
var DATA_KEY = 'bs.dropdown';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.dropdown',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.dropdown',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.dropdown',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.dropdown',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.dropdown',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
KEYDOWN: 'keydown.bs.dropdown.data-api',
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
CLICK_DATA: 'click.bs.dropdown.data-api'
|
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -1299,7 +1350,9 @@ var Dropdown = (function ($) {
|
|||||||
function Dropdown(element) {
|
function Dropdown(element) {
|
||||||
_classCallCheck(this, Dropdown);
|
_classCallCheck(this, Dropdown);
|
||||||
|
|
||||||
$(element).on(Event.CLICK, this.toggle);
|
this._element = element;
|
||||||
|
|
||||||
|
this._addEventListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
_createClass(Dropdown, [{
|
_createClass(Dropdown, [{
|
||||||
@ -1347,6 +1400,21 @@ var Dropdown = (function ($) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: '_addEventListeners',
|
||||||
|
|
||||||
|
// private
|
||||||
|
|
||||||
|
value: function _addEventListeners() {
|
||||||
|
$(this._element).on(Event.CLICK, this.toggle);
|
||||||
|
}
|
||||||
}], [{
|
}], [{
|
||||||
key: 'VERSION',
|
key: 'VERSION',
|
||||||
|
|
||||||
@ -1479,7 +1547,7 @@ var Dropdown = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.KEYDOWN, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA, Dropdown._clearMenus).on(Event.CLICK_DATA, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA, Selector.FORM_CHILD, function (e) {
|
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1517,6 +1585,8 @@ var Modal = (function ($) {
|
|||||||
var NAME = 'modal';
|
var NAME = 'modal';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.modal';
|
var DATA_KEY = 'bs.modal';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 300;
|
var TRANSITION_DURATION = 300;
|
||||||
var BACKDROP_TRANSITION_DURATION = 150;
|
var BACKDROP_TRANSITION_DURATION = 150;
|
||||||
@ -1528,17 +1598,17 @@ var Modal = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.modal',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.modal',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.modal',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.modal',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
DISMISS: 'click.dismiss.bs.modal',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
KEYDOWN: 'keydown.dismiss.bs.modal',
|
RESIZE: 'resize' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.modal',
|
CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
|
||||||
RESIZE: 'resize.bs.modal',
|
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.modal.data-api',
|
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
|
||||||
MOUSEDOWN: 'mousedown.dismiss.bs.modal',
|
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
|
||||||
MOUSEUP: 'mouseup.dismiss.bs.modal'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -1609,10 +1679,10 @@ var Modal = (function ($) {
|
|||||||
this._setEscapeEvent();
|
this._setEscapeEvent();
|
||||||
this._setResizeEvent();
|
this._setResizeEvent();
|
||||||
|
|
||||||
$(this._element).on(Event.DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
||||||
|
|
||||||
$(this._dialog).on(Event.MOUSEDOWN, function () {
|
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
||||||
$(_this7._element).one(Event.MOUSEUP, function (event) {
|
$(_this7._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
||||||
if ($(event.target).is(_this7._element)) {
|
if ($(event.target).is(_this7._element)) {
|
||||||
that._ignoreBackdropClick = true;
|
that._ignoreBackdropClick = true;
|
||||||
}
|
}
|
||||||
@ -1645,8 +1715,8 @@ var Modal = (function ($) {
|
|||||||
|
|
||||||
$(this._element).removeClass(ClassName.IN);
|
$(this._element).removeClass(ClassName.IN);
|
||||||
|
|
||||||
$(this._element).off(Event.DISMISS);
|
$(this._element).off(Event.CLICK_DISMISS);
|
||||||
$(this._dialog).off(Event.MOUSEDOWN);
|
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
||||||
|
|
||||||
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
||||||
|
|
||||||
@ -1655,6 +1725,26 @@ var Modal = (function ($) {
|
|||||||
this._hideModal();
|
this._hideModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
$(window).off(EVENT_KEY);
|
||||||
|
$(document).off(EVENT_KEY);
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
$(this._backdrop).off(EVENT_KEY);
|
||||||
|
|
||||||
|
this._config = null;
|
||||||
|
this._element = null;
|
||||||
|
this._dialog = null;
|
||||||
|
this._backdrop = null;
|
||||||
|
this._isShown = null;
|
||||||
|
this._isBodyOverflowing = null;
|
||||||
|
this._ignoreBackdropClick = null;
|
||||||
|
this._originalBodyPadding = null;
|
||||||
|
this._scrollbarWidth = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_showElement',
|
key: '_showElement',
|
||||||
|
|
||||||
@ -1714,13 +1804,13 @@ var Modal = (function ($) {
|
|||||||
var _this10 = this;
|
var _this10 = this;
|
||||||
|
|
||||||
if (this._isShown && this._config.keyboard) {
|
if (this._isShown && this._config.keyboard) {
|
||||||
$(this._element).on(Event.KEYDOWN, function (event) {
|
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
_this10.hide();
|
_this10.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!this._isShown) {
|
} else if (!this._isShown) {
|
||||||
$(this._element).off(Event.KEYDOWN);
|
$(this._element).off(Event.KEYDOWN_DISMISS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -1772,7 +1862,7 @@ var Modal = (function ($) {
|
|||||||
|
|
||||||
$(this._backdrop).appendTo(this.$body);
|
$(this._backdrop).appendTo(this.$body);
|
||||||
|
|
||||||
$(this._element).on(Event.DISMISS, function (event) {
|
$(this._element).on(Event.CLICK_DISMISS, function (event) {
|
||||||
if (_this12._ignoreBackdropClick) {
|
if (_this12._ignoreBackdropClick) {
|
||||||
_this12._ignoreBackdropClick = false;
|
_this12._ignoreBackdropClick = false;
|
||||||
return;
|
return;
|
||||||
@ -1937,7 +2027,7 @@ var Modal = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
var _this13 = this;
|
var _this13 = this;
|
||||||
|
|
||||||
var target = undefined;
|
var target = undefined;
|
||||||
@ -2003,6 +2093,8 @@ var ScrollSpy = (function ($) {
|
|||||||
var NAME = 'scrollspy';
|
var NAME = 'scrollspy';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.scrollspy';
|
var DATA_KEY = 'bs.scrollspy';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
@ -2010,9 +2102,9 @@ var ScrollSpy = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
ACTIVATE: 'activate.bs.scrollspy',
|
ACTIVATE: 'activate' + EVENT_KEY,
|
||||||
SCROLL: 'scroll.bs.scrollspy',
|
SCROLL: 'scroll' + EVENT_KEY,
|
||||||
LOAD: 'load.bs.scrollspy.data-api'
|
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -2037,6 +2129,7 @@ var ScrollSpy = (function ($) {
|
|||||||
function ScrollSpy(element, config) {
|
function ScrollSpy(element, config) {
|
||||||
_classCallCheck(this, ScrollSpy);
|
_classCallCheck(this, ScrollSpy);
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||||
this._config = $.extend({}, Default, config);
|
this._config = $.extend({}, Default, config);
|
||||||
this._selector = '' + (this._config.target || '') + ' .nav li > a';
|
this._selector = '' + (this._config.target || '') + ' .nav li > a';
|
||||||
@ -2095,6 +2188,21 @@ var ScrollSpy = (function ($) {
|
|||||||
_this14._targets.push(item[1]);
|
_this14._targets.push(item[1]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
$(this._scrollElement).off(EVENT_KEY);
|
||||||
|
|
||||||
|
this._element = null;
|
||||||
|
this._scrollElement = null;
|
||||||
|
this._config = null;
|
||||||
|
this._selector = null;
|
||||||
|
this._offsets = null;
|
||||||
|
this._targets = null;
|
||||||
|
this._activeTarget = null;
|
||||||
|
this._scrollHeight = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getScrollTop',
|
key: '_getScrollTop',
|
||||||
|
|
||||||
@ -2221,7 +2329,7 @@ var ScrollSpy = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
||||||
|
|
||||||
for (var i = scrollSpys.length; i--;) {
|
for (var i = scrollSpys.length; i--;) {
|
||||||
@ -2264,15 +2372,17 @@ var Tab = (function ($) {
|
|||||||
var NAME = 'tab';
|
var NAME = 'tab';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.tab';
|
var DATA_KEY = 'bs.tab';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.tab',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.tab',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.tab',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.tab',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.tab.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -2376,6 +2486,12 @@ var Tab = (function ($) {
|
|||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeClass(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_activate',
|
key: '_activate',
|
||||||
|
|
||||||
@ -2489,7 +2605,7 @@ var Tab = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
Tab._jQueryInterface.call($(this), 'show');
|
Tab._jQueryInterface.call($(this), 'show');
|
||||||
});
|
});
|
||||||
@ -2528,6 +2644,7 @@ var Tooltip = (function ($) {
|
|||||||
var NAME = 'tooltip';
|
var NAME = 'tooltip';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.tooltip';
|
var DATA_KEY = 'bs.tooltip';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
var CLASS_PREFIX = 'bs-tether';
|
var CLASS_PREFIX = 'bs-tether';
|
||||||
@ -2558,16 +2675,16 @@ var Tooltip = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.tooltip',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.tooltip',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.tooltip',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.tooltip',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
INSERTED: 'inserted.bs.tooltip',
|
INSERTED: 'inserted' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.tooltip',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.tooltip',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
FOCUSOUT: 'focusout.bs.tooltip',
|
FOCUSOUT: 'focusout' + EVENT_KEY,
|
||||||
MOUSEENTER: 'mouseenter.bs.tooltip',
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
MOUSELEAVE: 'mouseleave.bs.tooltip'
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -2661,25 +2778,34 @@ var Tooltip = (function ($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'destroy',
|
key: 'dispose',
|
||||||
value: function destroy() {
|
value: function dispose() {
|
||||||
var _this16 = this;
|
|
||||||
|
|
||||||
clearTimeout(this._timeout);
|
clearTimeout(this._timeout);
|
||||||
this.hide(function () {
|
|
||||||
$(_this16.element).off('.' + _this16.constructor.NAME).removeData(_this16.constructor.DATA_KEY);
|
|
||||||
|
|
||||||
if (_this16.tip) {
|
this.cleanupTether();
|
||||||
$(_this16.tip).detach();
|
|
||||||
|
$.removeData(this.element, this.constructor.DATA_KEY);
|
||||||
|
|
||||||
|
$(this.element).off(this.constructor.EVENT_KEY);
|
||||||
|
|
||||||
|
if (this.tip) {
|
||||||
|
$(this.tip).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
_this16.tip = null;
|
this._isEnabled = null;
|
||||||
});
|
this._timeout = null;
|
||||||
|
this._hoverState = null;
|
||||||
|
this._activeTrigger = null;
|
||||||
|
this._tether = null;
|
||||||
|
|
||||||
|
this.element = null;
|
||||||
|
this.config = null;
|
||||||
|
this.tip = null;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'show',
|
key: 'show',
|
||||||
value: function show() {
|
value: function show() {
|
||||||
var _this17 = this;
|
var _this16 = this;
|
||||||
|
|
||||||
var showEvent = $.Event(this.constructor.Event.SHOW);
|
var showEvent = $.Event(this.constructor.Event.SHOW);
|
||||||
|
|
||||||
@ -2728,13 +2854,13 @@ var Tooltip = (function ($) {
|
|||||||
$(tip).addClass(ClassName.IN);
|
$(tip).addClass(ClassName.IN);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
var prevHoverState = _this17._hoverState;
|
var prevHoverState = _this16._hoverState;
|
||||||
_this17._hoverState = null;
|
_this16._hoverState = null;
|
||||||
|
|
||||||
$(_this17.element).trigger(_this17.constructor.Event.SHOWN);
|
$(_this16.element).trigger(_this16.constructor.Event.SHOWN);
|
||||||
|
|
||||||
if (prevHoverState === HoverState.OUT) {
|
if (prevHoverState === HoverState.OUT) {
|
||||||
_this17._leave(null, _this17);
|
_this16._leave(null, _this16);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2744,18 +2870,18 @@ var Tooltip = (function ($) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'hide',
|
key: 'hide',
|
||||||
value: function hide(callback) {
|
value: function hide(callback) {
|
||||||
var _this18 = this;
|
var _this17 = this;
|
||||||
|
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
if (_this18._hoverState !== HoverState.IN && tip.parentNode) {
|
if (_this17._hoverState !== HoverState.IN && tip.parentNode) {
|
||||||
tip.parentNode.removeChild(tip);
|
tip.parentNode.removeChild(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
_this18.element.removeAttribute('aria-describedby');
|
_this17.element.removeAttribute('aria-describedby');
|
||||||
$(_this18.element).trigger(_this18.constructor.Event.HIDDEN);
|
$(_this17.element).trigger(_this17.constructor.Event.HIDDEN);
|
||||||
_this18.cleanupTether();
|
_this17.cleanupTether();
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
@ -2840,18 +2966,18 @@ var Tooltip = (function ($) {
|
|||||||
}, {
|
}, {
|
||||||
key: '_setListeners',
|
key: '_setListeners',
|
||||||
value: function _setListeners() {
|
value: function _setListeners() {
|
||||||
var _this19 = this;
|
var _this18 = this;
|
||||||
|
|
||||||
var triggers = this.config.trigger.split(' ');
|
var triggers = this.config.trigger.split(' ');
|
||||||
|
|
||||||
triggers.forEach(function (trigger) {
|
triggers.forEach(function (trigger) {
|
||||||
if (trigger === 'click') {
|
if (trigger === 'click') {
|
||||||
$(_this19.element).on(_this19.constructor.Event.CLICK, _this19.config.selector, $.proxy(_this19.toggle, _this19));
|
$(_this18.element).on(_this18.constructor.Event.CLICK, _this18.config.selector, $.proxy(_this18.toggle, _this18));
|
||||||
} else if (trigger !== Trigger.MANUAL) {
|
} else if (trigger !== Trigger.MANUAL) {
|
||||||
var eventIn = trigger == Trigger.HOVER ? _this19.constructor.Event.MOUSEENTER : _this19.constructor.Event.FOCUSIN;
|
var eventIn = trigger == Trigger.HOVER ? _this18.constructor.Event.MOUSEENTER : _this18.constructor.Event.FOCUSIN;
|
||||||
var eventOut = trigger == Trigger.HOVER ? _this19.constructor.Event.MOUSELEAVE : _this19.constructor.Event.FOCUSOUT;
|
var eventOut = trigger == Trigger.HOVER ? _this18.constructor.Event.MOUSELEAVE : _this18.constructor.Event.FOCUSOUT;
|
||||||
|
|
||||||
$(_this19.element).on(eventIn, _this19.config.selector, $.proxy(_this19._enter, _this19)).on(eventOut, _this19.config.selector, $.proxy(_this19._leave, _this19));
|
$(_this18.element).on(eventIn, _this18.config.selector, $.proxy(_this18._enter, _this18)).on(eventOut, _this18.config.selector, $.proxy(_this18._leave, _this18));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -3018,6 +3144,11 @@ var Tooltip = (function ($) {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return Event;
|
return Event;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'EVENT_KEY',
|
||||||
|
get: function () {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_jQueryInterface',
|
key: '_jQueryInterface',
|
||||||
|
|
||||||
@ -3081,6 +3212,7 @@ var Popover = (function ($) {
|
|||||||
var NAME = 'popover';
|
var NAME = 'popover';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.popover';
|
var DATA_KEY = 'bs.popover';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Default = $.extend({}, Tooltip.Default, {
|
var Default = $.extend({}, Tooltip.Default, {
|
||||||
@ -3102,16 +3234,16 @@ var Popover = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.popover',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.popover',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.popover',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.popover',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
INSERTED: 'inserted.bs.popover',
|
INSERTED: 'inserted' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.popover',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.popover',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
FOCUSOUT: 'focusout.bs.popover',
|
FOCUSOUT: 'focusout' + EVENT_KEY,
|
||||||
MOUSEENTER: 'mouseenter.bs.popover',
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
MOUSELEAVE: 'mouseleave.bs.popover'
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3199,6 +3331,11 @@ var Popover = (function ($) {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return Event;
|
return Event;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'EVENT_KEY',
|
||||||
|
get: function () {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_jQueryInterface',
|
key: '_jQueryInterface',
|
||||||
|
|
||||||
|
4
dist/js/bootstrap.min.js
vendored
4
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
16
dist/js/umd/alert.js
vendored
16
dist/js/umd/alert.js
vendored
@ -39,6 +39,8 @@
|
|||||||
var NAME = 'alert';
|
var NAME = 'alert';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.alert';
|
var DATA_KEY = 'bs.alert';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
@ -47,9 +49,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
CLOSE: 'close.bs.alert',
|
CLOSE: 'close' + EVENT_KEY,
|
||||||
CLOSED: 'closed.bs.alert',
|
CLOSED: 'closed' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.alert.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -88,6 +90,12 @@
|
|||||||
|
|
||||||
this._removeElement(rootElement);
|
this._removeElement(rootElement);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getRootElement',
|
key: '_getRootElement',
|
||||||
|
|
||||||
@ -181,7 +189,7 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
16
dist/js/umd/button.js
vendored
16
dist/js/umd/button.js
vendored
@ -35,6 +35,8 @@
|
|||||||
var NAME = 'button';
|
var NAME = 'button';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.button';
|
var DATA_KEY = 'bs.button';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
@ -53,8 +55,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
CLICK: 'click.bs.button.data-api',
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
FOCUS_BLUR: 'focus.bs.button.data-api blur.bs.button.data-api'
|
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + '' + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + '' + DATA_API_KEY)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,6 +110,12 @@
|
|||||||
$(this._element).toggleClass(ClassName.ACTIVE);
|
$(this._element).toggleClass(ClassName.ACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}], [{
|
}], [{
|
||||||
key: 'VERSION',
|
key: 'VERSION',
|
||||||
|
|
||||||
@ -146,7 +154,7 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE_CARROT, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var button = event.target;
|
var button = event.target;
|
||||||
@ -156,7 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button._jQueryInterface.call($(button), 'toggle');
|
Button._jQueryInterface.call($(button), 'toggle');
|
||||||
}).on(Event.FOCUS_BLUR, Selector.DATA_TOGGLE_CARROT, function (event) {
|
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
var button = $(event.target).closest(Selector.BUTTON)[0];
|
var button = $(event.target).closest(Selector.BUTTON)[0];
|
||||||
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
||||||
});
|
});
|
||||||
|
36
dist/js/umd/carousel.js
vendored
36
dist/js/umd/carousel.js
vendored
@ -39,6 +39,8 @@
|
|||||||
var NAME = 'carousel';
|
var NAME = 'carousel';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.carousel';
|
var DATA_KEY = 'bs.carousel';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 600;
|
var TRANSITION_DURATION = 600;
|
||||||
|
|
||||||
@ -56,10 +58,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
SLIDE: 'slide.bs.carousel',
|
SLIDE: 'slide' + EVENT_KEY,
|
||||||
SLID: 'slid.bs.carousel',
|
SLID: 'slid' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.carousel.data-api',
|
KEYDOWN: 'keydown' + EVENT_KEY,
|
||||||
LOAD: 'load'
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
|
||||||
|
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -183,6 +188,21 @@
|
|||||||
|
|
||||||
this._slide(direction, this._items[index]);
|
this._slide(direction, this._items[index]);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
this._items = null;
|
||||||
|
this._config = null;
|
||||||
|
this._element = null;
|
||||||
|
this._interval = null;
|
||||||
|
this._isPaused = null;
|
||||||
|
this._isSliding = null;
|
||||||
|
this._activeElement = null;
|
||||||
|
this._indicatorsElement = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_addEventListeners',
|
key: '_addEventListeners',
|
||||||
|
|
||||||
@ -190,11 +210,11 @@
|
|||||||
|
|
||||||
value: function _addEventListeners() {
|
value: function _addEventListeners() {
|
||||||
if (this._config.keyboard) {
|
if (this._config.keyboard) {
|
||||||
$(this._element).on('keydown.bs.carousel', $.proxy(this._keydown, this));
|
$(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.pause == 'hover' && !('ontouchstart' in document.documentElement)) {
|
if (this._config.pause == 'hover' && !('ontouchstart' in document.documentElement)) {
|
||||||
$(this._element).on('mouseenter.bs.carousel', $.proxy(this.pause, this)).on('mouseleave.bs.carousel', $.proxy(this.cycle, this));
|
$(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -421,9 +441,9 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
$(Selector.DATA_RIDE).each(function () {
|
$(Selector.DATA_RIDE).each(function () {
|
||||||
var $carousel = $(this);
|
var $carousel = $(this);
|
||||||
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
||||||
|
27
dist/js/umd/collapse.js
vendored
27
dist/js/umd/collapse.js
vendored
@ -39,6 +39,8 @@
|
|||||||
var NAME = 'collapse';
|
var NAME = 'collapse';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.collapse';
|
var DATA_KEY = 'bs.collapse';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 600;
|
var TRANSITION_DURATION = 600;
|
||||||
|
|
||||||
@ -48,11 +50,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
SHOW: 'show.bs.collapse',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.collapse',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
HIDE: 'hide.bs.collapse',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.collapse',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.collapse.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -119,8 +121,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var activesData = undefined;
|
|
||||||
var actives = undefined;
|
var actives = undefined;
|
||||||
|
var activesData = undefined;
|
||||||
|
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
actives = $.makeArray($(Selector.ACTIVES));
|
actives = $.makeArray($(Selector.ACTIVES));
|
||||||
@ -233,6 +235,17 @@
|
|||||||
value: function setTransitioning(isTransitioning) {
|
value: function setTransitioning(isTransitioning) {
|
||||||
this._isTransitioning = isTransitioning;
|
this._isTransitioning = isTransitioning;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
this._config = null;
|
||||||
|
this._parent = null;
|
||||||
|
this._element = null;
|
||||||
|
this._triggerArray = null;
|
||||||
|
this._isTransitioning = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getDimension',
|
key: '_getDimension',
|
||||||
|
|
||||||
@ -323,7 +336,7 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var target = Collapse._getTargetFromElement(this);
|
var target = Collapse._getTargetFromElement(this);
|
||||||
|
37
dist/js/umd/dropdown.js
vendored
37
dist/js/umd/dropdown.js
vendored
@ -39,16 +39,18 @@
|
|||||||
var NAME = 'dropdown';
|
var NAME = 'dropdown';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.dropdown';
|
var DATA_KEY = 'bs.dropdown';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.dropdown',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.dropdown',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.dropdown',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.dropdown',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.dropdown',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
KEYDOWN: 'keydown.bs.dropdown.data-api',
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
CLICK_DATA: 'click.bs.dropdown.data-api'
|
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -77,7 +79,9 @@
|
|||||||
function Dropdown(element) {
|
function Dropdown(element) {
|
||||||
_classCallCheck(this, Dropdown);
|
_classCallCheck(this, Dropdown);
|
||||||
|
|
||||||
$(element).on(Event.CLICK, this.toggle);
|
this._element = element;
|
||||||
|
|
||||||
|
this._addEventListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
_createClass(Dropdown, [{
|
_createClass(Dropdown, [{
|
||||||
@ -125,6 +129,21 @@
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: '_addEventListeners',
|
||||||
|
|
||||||
|
// private
|
||||||
|
|
||||||
|
value: function _addEventListeners() {
|
||||||
|
$(this._element).on(Event.CLICK, this.toggle);
|
||||||
|
}
|
||||||
}], [{
|
}], [{
|
||||||
key: 'VERSION',
|
key: 'VERSION',
|
||||||
|
|
||||||
@ -257,7 +276,7 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.KEYDOWN, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA, Dropdown._clearMenus).on(Event.CLICK_DATA, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA, Selector.FORM_CHILD, function (e) {
|
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
62
dist/js/umd/modal.js
vendored
62
dist/js/umd/modal.js
vendored
@ -39,6 +39,8 @@
|
|||||||
var NAME = 'modal';
|
var NAME = 'modal';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.modal';
|
var DATA_KEY = 'bs.modal';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 300;
|
var TRANSITION_DURATION = 300;
|
||||||
var BACKDROP_TRANSITION_DURATION = 150;
|
var BACKDROP_TRANSITION_DURATION = 150;
|
||||||
@ -50,17 +52,17 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.modal',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.modal',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.modal',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.modal',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
DISMISS: 'click.dismiss.bs.modal',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
KEYDOWN: 'keydown.dismiss.bs.modal',
|
RESIZE: 'resize' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.modal',
|
CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
|
||||||
RESIZE: 'resize.bs.modal',
|
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.modal.data-api',
|
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
|
||||||
MOUSEDOWN: 'mousedown.dismiss.bs.modal',
|
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
|
||||||
MOUSEUP: 'mouseup.dismiss.bs.modal'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -131,10 +133,10 @@
|
|||||||
this._setEscapeEvent();
|
this._setEscapeEvent();
|
||||||
this._setResizeEvent();
|
this._setResizeEvent();
|
||||||
|
|
||||||
$(this._element).on(Event.DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
||||||
|
|
||||||
$(this._dialog).on(Event.MOUSEDOWN, function () {
|
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
||||||
$(_this._element).one(Event.MOUSEUP, function (event) {
|
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
||||||
if ($(event.target).is(_this._element)) {
|
if ($(event.target).is(_this._element)) {
|
||||||
that._ignoreBackdropClick = true;
|
that._ignoreBackdropClick = true;
|
||||||
}
|
}
|
||||||
@ -167,8 +169,8 @@
|
|||||||
|
|
||||||
$(this._element).removeClass(ClassName.IN);
|
$(this._element).removeClass(ClassName.IN);
|
||||||
|
|
||||||
$(this._element).off(Event.DISMISS);
|
$(this._element).off(Event.CLICK_DISMISS);
|
||||||
$(this._dialog).off(Event.MOUSEDOWN);
|
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
||||||
|
|
||||||
if (_Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
if (_Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
||||||
|
|
||||||
@ -177,6 +179,26 @@
|
|||||||
this._hideModal();
|
this._hideModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
$(window).off(EVENT_KEY);
|
||||||
|
$(document).off(EVENT_KEY);
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
$(this._backdrop).off(EVENT_KEY);
|
||||||
|
|
||||||
|
this._config = null;
|
||||||
|
this._element = null;
|
||||||
|
this._dialog = null;
|
||||||
|
this._backdrop = null;
|
||||||
|
this._isShown = null;
|
||||||
|
this._isBodyOverflowing = null;
|
||||||
|
this._ignoreBackdropClick = null;
|
||||||
|
this._originalBodyPadding = null;
|
||||||
|
this._scrollbarWidth = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_showElement',
|
key: '_showElement',
|
||||||
|
|
||||||
@ -236,13 +258,13 @@
|
|||||||
var _this4 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
if (this._isShown && this._config.keyboard) {
|
if (this._isShown && this._config.keyboard) {
|
||||||
$(this._element).on(Event.KEYDOWN, function (event) {
|
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
_this4.hide();
|
_this4.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!this._isShown) {
|
} else if (!this._isShown) {
|
||||||
$(this._element).off(Event.KEYDOWN);
|
$(this._element).off(Event.KEYDOWN_DISMISS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -294,7 +316,7 @@
|
|||||||
|
|
||||||
$(this._backdrop).appendTo(this.$body);
|
$(this._backdrop).appendTo(this.$body);
|
||||||
|
|
||||||
$(this._element).on(Event.DISMISS, function (event) {
|
$(this._element).on(Event.CLICK_DISMISS, function (event) {
|
||||||
if (_this6._ignoreBackdropClick) {
|
if (_this6._ignoreBackdropClick) {
|
||||||
_this6._ignoreBackdropClick = false;
|
_this6._ignoreBackdropClick = false;
|
||||||
return;
|
return;
|
||||||
@ -459,7 +481,7 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
var _this7 = this;
|
var _this7 = this;
|
||||||
|
|
||||||
var target = undefined;
|
var target = undefined;
|
||||||
|
26
dist/js/umd/popover.js
vendored
26
dist/js/umd/popover.js
vendored
@ -41,6 +41,7 @@
|
|||||||
var NAME = 'popover';
|
var NAME = 'popover';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.popover';
|
var DATA_KEY = 'bs.popover';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Default = $.extend({}, _Tooltip2.Default, {
|
var Default = $.extend({}, _Tooltip2.Default, {
|
||||||
@ -62,16 +63,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.popover',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.popover',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.popover',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.popover',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
INSERTED: 'inserted.bs.popover',
|
INSERTED: 'inserted' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.popover',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.popover',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
FOCUSOUT: 'focusout.bs.popover',
|
FOCUSOUT: 'focusout' + EVENT_KEY,
|
||||||
MOUSEENTER: 'mouseenter.bs.popover',
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
MOUSELEAVE: 'mouseleave.bs.popover'
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,6 +160,11 @@
|
|||||||
get: function () {
|
get: function () {
|
||||||
return Event;
|
return Event;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'EVENT_KEY',
|
||||||
|
get: function () {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_jQueryInterface',
|
key: '_jQueryInterface',
|
||||||
|
|
||||||
|
26
dist/js/umd/scrollspy.js
vendored
26
dist/js/umd/scrollspy.js
vendored
@ -39,6 +39,8 @@
|
|||||||
var NAME = 'scrollspy';
|
var NAME = 'scrollspy';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.scrollspy';
|
var DATA_KEY = 'bs.scrollspy';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
@ -46,9 +48,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
ACTIVATE: 'activate.bs.scrollspy',
|
ACTIVATE: 'activate' + EVENT_KEY,
|
||||||
SCROLL: 'scroll.bs.scrollspy',
|
SCROLL: 'scroll' + EVENT_KEY,
|
||||||
LOAD: 'load.bs.scrollspy.data-api'
|
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -73,6 +75,7 @@
|
|||||||
function ScrollSpy(element, config) {
|
function ScrollSpy(element, config) {
|
||||||
_classCallCheck(this, ScrollSpy);
|
_classCallCheck(this, ScrollSpy);
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||||
this._config = $.extend({}, Default, config);
|
this._config = $.extend({}, Default, config);
|
||||||
this._selector = '' + (this._config.target || '') + ' .nav li > a';
|
this._selector = '' + (this._config.target || '') + ' .nav li > a';
|
||||||
@ -131,6 +134,21 @@
|
|||||||
_this._targets.push(item[1]);
|
_this._targets.push(item[1]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
$(this._scrollElement).off(EVENT_KEY);
|
||||||
|
|
||||||
|
this._element = null;
|
||||||
|
this._scrollElement = null;
|
||||||
|
this._config = null;
|
||||||
|
this._selector = null;
|
||||||
|
this._offsets = null;
|
||||||
|
this._targets = null;
|
||||||
|
this._activeTarget = null;
|
||||||
|
this._scrollHeight = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getScrollTop',
|
key: '_getScrollTop',
|
||||||
|
|
||||||
@ -257,7 +275,7 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
||||||
|
|
||||||
for (var i = scrollSpys.length; i--;) {
|
for (var i = scrollSpys.length; i--;) {
|
||||||
|
20
dist/js/umd/tab.js
vendored
20
dist/js/umd/tab.js
vendored
@ -39,15 +39,17 @@
|
|||||||
var NAME = 'tab';
|
var NAME = 'tab';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.tab';
|
var DATA_KEY = 'bs.tab';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.tab',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.tab',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.tab',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.tab',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.tab.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -151,6 +153,12 @@
|
|||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeClass(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_activate',
|
key: '_activate',
|
||||||
|
|
||||||
@ -264,7 +272,7 @@
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
Tab._jQueryInterface.call($(this), 'show');
|
Tab._jQueryInterface.call($(this), 'show');
|
||||||
});
|
});
|
||||||
|
85
dist/js/umd/tooltip.js
vendored
85
dist/js/umd/tooltip.js
vendored
@ -39,6 +39,7 @@
|
|||||||
var NAME = 'tooltip';
|
var NAME = 'tooltip';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.tooltip';
|
var DATA_KEY = 'bs.tooltip';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
var CLASS_PREFIX = 'bs-tether';
|
var CLASS_PREFIX = 'bs-tether';
|
||||||
@ -69,16 +70,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.tooltip',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.tooltip',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.tooltip',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.tooltip',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
INSERTED: 'inserted.bs.tooltip',
|
INSERTED: 'inserted' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.tooltip',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.tooltip',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
FOCUSOUT: 'focusout.bs.tooltip',
|
FOCUSOUT: 'focusout' + EVENT_KEY,
|
||||||
MOUSEENTER: 'mouseenter.bs.tooltip',
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
MOUSELEAVE: 'mouseleave.bs.tooltip'
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -172,25 +173,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'destroy',
|
key: 'dispose',
|
||||||
value: function destroy() {
|
value: function dispose() {
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
clearTimeout(this._timeout);
|
clearTimeout(this._timeout);
|
||||||
this.hide(function () {
|
|
||||||
$(_this.element).off('.' + _this.constructor.NAME).removeData(_this.constructor.DATA_KEY);
|
|
||||||
|
|
||||||
if (_this.tip) {
|
this.cleanupTether();
|
||||||
$(_this.tip).detach();
|
|
||||||
|
$.removeData(this.element, this.constructor.DATA_KEY);
|
||||||
|
|
||||||
|
$(this.element).off(this.constructor.EVENT_KEY);
|
||||||
|
|
||||||
|
if (this.tip) {
|
||||||
|
$(this.tip).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
_this.tip = null;
|
this._isEnabled = null;
|
||||||
});
|
this._timeout = null;
|
||||||
|
this._hoverState = null;
|
||||||
|
this._activeTrigger = null;
|
||||||
|
this._tether = null;
|
||||||
|
|
||||||
|
this.element = null;
|
||||||
|
this.config = null;
|
||||||
|
this.tip = null;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'show',
|
key: 'show',
|
||||||
value: function show() {
|
value: function show() {
|
||||||
var _this2 = this;
|
var _this = this;
|
||||||
|
|
||||||
var showEvent = $.Event(this.constructor.Event.SHOW);
|
var showEvent = $.Event(this.constructor.Event.SHOW);
|
||||||
|
|
||||||
@ -239,13 +249,13 @@
|
|||||||
$(tip).addClass(ClassName.IN);
|
$(tip).addClass(ClassName.IN);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
var prevHoverState = _this2._hoverState;
|
var prevHoverState = _this._hoverState;
|
||||||
_this2._hoverState = null;
|
_this._hoverState = null;
|
||||||
|
|
||||||
$(_this2.element).trigger(_this2.constructor.Event.SHOWN);
|
$(_this.element).trigger(_this.constructor.Event.SHOWN);
|
||||||
|
|
||||||
if (prevHoverState === HoverState.OUT) {
|
if (prevHoverState === HoverState.OUT) {
|
||||||
_this2._leave(null, _this2);
|
_this._leave(null, _this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -255,18 +265,18 @@
|
|||||||
}, {
|
}, {
|
||||||
key: 'hide',
|
key: 'hide',
|
||||||
value: function hide(callback) {
|
value: function hide(callback) {
|
||||||
var _this3 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
if (_this3._hoverState !== HoverState.IN && tip.parentNode) {
|
if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
|
||||||
tip.parentNode.removeChild(tip);
|
tip.parentNode.removeChild(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
_this3.element.removeAttribute('aria-describedby');
|
_this2.element.removeAttribute('aria-describedby');
|
||||||
$(_this3.element).trigger(_this3.constructor.Event.HIDDEN);
|
$(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
|
||||||
_this3.cleanupTether();
|
_this2.cleanupTether();
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
@ -351,18 +361,18 @@
|
|||||||
}, {
|
}, {
|
||||||
key: '_setListeners',
|
key: '_setListeners',
|
||||||
value: function _setListeners() {
|
value: function _setListeners() {
|
||||||
var _this4 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
var triggers = this.config.trigger.split(' ');
|
var triggers = this.config.trigger.split(' ');
|
||||||
|
|
||||||
triggers.forEach(function (trigger) {
|
triggers.forEach(function (trigger) {
|
||||||
if (trigger === 'click') {
|
if (trigger === 'click') {
|
||||||
$(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, $.proxy(_this4.toggle, _this4));
|
$(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3));
|
||||||
} else if (trigger !== Trigger.MANUAL) {
|
} else if (trigger !== Trigger.MANUAL) {
|
||||||
var eventIn = trigger == Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
|
var eventIn = trigger == Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
|
||||||
var eventOut = trigger == Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
|
var eventOut = trigger == Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
|
||||||
|
|
||||||
$(_this4.element).on(eventIn, _this4.config.selector, $.proxy(_this4._enter, _this4)).on(eventOut, _this4.config.selector, $.proxy(_this4._leave, _this4));
|
$(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -529,6 +539,11 @@
|
|||||||
get: function () {
|
get: function () {
|
||||||
return Event;
|
return Event;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'EVENT_KEY',
|
||||||
|
get: function () {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_jQueryInterface',
|
key: '_jQueryInterface',
|
||||||
|
|
||||||
|
16
js/dist/alert.js
vendored
16
js/dist/alert.js
vendored
@ -22,6 +22,8 @@ var Alert = (function ($) {
|
|||||||
var NAME = 'alert';
|
var NAME = 'alert';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.alert';
|
var DATA_KEY = 'bs.alert';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
@ -30,9 +32,9 @@ var Alert = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
CLOSE: 'close.bs.alert',
|
CLOSE: 'close' + EVENT_KEY,
|
||||||
CLOSED: 'closed.bs.alert',
|
CLOSED: 'closed' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.alert.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -71,6 +73,12 @@ var Alert = (function ($) {
|
|||||||
|
|
||||||
this._removeElement(rootElement);
|
this._removeElement(rootElement);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getRootElement',
|
key: '_getRootElement',
|
||||||
|
|
||||||
@ -164,7 +172,7 @@ var Alert = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
2
js/dist/alert.js.map
vendored
2
js/dist/alert.js.map
vendored
File diff suppressed because one or more lines are too long
16
js/dist/button.js
vendored
16
js/dist/button.js
vendored
@ -22,6 +22,8 @@ var Button = (function ($) {
|
|||||||
var NAME = 'button';
|
var NAME = 'button';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.button';
|
var DATA_KEY = 'bs.button';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
@ -40,8 +42,8 @@ var Button = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
CLICK: 'click.bs.button.data-api',
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
FOCUS_BLUR: 'focus.bs.button.data-api blur.bs.button.data-api'
|
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + '' + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + '' + DATA_API_KEY)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,6 +97,12 @@ var Button = (function ($) {
|
|||||||
$(this._element).toggleClass(ClassName.ACTIVE);
|
$(this._element).toggleClass(ClassName.ACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}], [{
|
}], [{
|
||||||
key: 'VERSION',
|
key: 'VERSION',
|
||||||
|
|
||||||
@ -133,7 +141,7 @@ var Button = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE_CARROT, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var button = event.target;
|
var button = event.target;
|
||||||
@ -143,7 +151,7 @@ var Button = (function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button._jQueryInterface.call($(button), 'toggle');
|
Button._jQueryInterface.call($(button), 'toggle');
|
||||||
}).on(Event.FOCUS_BLUR, Selector.DATA_TOGGLE_CARROT, function (event) {
|
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
var button = $(event.target).closest(Selector.BUTTON)[0];
|
var button = $(event.target).closest(Selector.BUTTON)[0];
|
||||||
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
||||||
});
|
});
|
||||||
|
2
js/dist/button.js.map
vendored
2
js/dist/button.js.map
vendored
File diff suppressed because one or more lines are too long
36
js/dist/carousel.js
vendored
36
js/dist/carousel.js
vendored
@ -22,6 +22,8 @@ var Carousel = (function ($) {
|
|||||||
var NAME = 'carousel';
|
var NAME = 'carousel';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.carousel';
|
var DATA_KEY = 'bs.carousel';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 600;
|
var TRANSITION_DURATION = 600;
|
||||||
|
|
||||||
@ -39,10 +41,13 @@ var Carousel = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
SLIDE: 'slide.bs.carousel',
|
SLIDE: 'slide' + EVENT_KEY,
|
||||||
SLID: 'slid.bs.carousel',
|
SLID: 'slid' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.carousel.data-api',
|
KEYDOWN: 'keydown' + EVENT_KEY,
|
||||||
LOAD: 'load'
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
|
||||||
|
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -166,6 +171,21 @@ var Carousel = (function ($) {
|
|||||||
|
|
||||||
this._slide(direction, this._items[index]);
|
this._slide(direction, this._items[index]);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
this._items = null;
|
||||||
|
this._config = null;
|
||||||
|
this._element = null;
|
||||||
|
this._interval = null;
|
||||||
|
this._isPaused = null;
|
||||||
|
this._isSliding = null;
|
||||||
|
this._activeElement = null;
|
||||||
|
this._indicatorsElement = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_addEventListeners',
|
key: '_addEventListeners',
|
||||||
|
|
||||||
@ -173,11 +193,11 @@ var Carousel = (function ($) {
|
|||||||
|
|
||||||
value: function _addEventListeners() {
|
value: function _addEventListeners() {
|
||||||
if (this._config.keyboard) {
|
if (this._config.keyboard) {
|
||||||
$(this._element).on('keydown.bs.carousel', $.proxy(this._keydown, this));
|
$(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.pause == 'hover' && !('ontouchstart' in document.documentElement)) {
|
if (this._config.pause == 'hover' && !('ontouchstart' in document.documentElement)) {
|
||||||
$(this._element).on('mouseenter.bs.carousel', $.proxy(this.pause, this)).on('mouseleave.bs.carousel', $.proxy(this.cycle, this));
|
$(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -404,9 +424,9 @@ var Carousel = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
$(Selector.DATA_RIDE).each(function () {
|
$(Selector.DATA_RIDE).each(function () {
|
||||||
var $carousel = $(this);
|
var $carousel = $(this);
|
||||||
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
||||||
|
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
27
js/dist/collapse.js
vendored
27
js/dist/collapse.js
vendored
@ -22,6 +22,8 @@ var Collapse = (function ($) {
|
|||||||
var NAME = 'collapse';
|
var NAME = 'collapse';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.collapse';
|
var DATA_KEY = 'bs.collapse';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 600;
|
var TRANSITION_DURATION = 600;
|
||||||
|
|
||||||
@ -31,11 +33,11 @@ var Collapse = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
SHOW: 'show.bs.collapse',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.collapse',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
HIDE: 'hide.bs.collapse',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.collapse',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.collapse.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -102,8 +104,8 @@ var Collapse = (function ($) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var activesData = undefined;
|
|
||||||
var actives = undefined;
|
var actives = undefined;
|
||||||
|
var activesData = undefined;
|
||||||
|
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
actives = $.makeArray($(Selector.ACTIVES));
|
actives = $.makeArray($(Selector.ACTIVES));
|
||||||
@ -216,6 +218,17 @@ var Collapse = (function ($) {
|
|||||||
value: function setTransitioning(isTransitioning) {
|
value: function setTransitioning(isTransitioning) {
|
||||||
this._isTransitioning = isTransitioning;
|
this._isTransitioning = isTransitioning;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
this._config = null;
|
||||||
|
this._parent = null;
|
||||||
|
this._element = null;
|
||||||
|
this._triggerArray = null;
|
||||||
|
this._isTransitioning = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getDimension',
|
key: '_getDimension',
|
||||||
|
|
||||||
@ -306,7 +319,7 @@ var Collapse = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var target = Collapse._getTargetFromElement(this);
|
var target = Collapse._getTargetFromElement(this);
|
||||||
|
2
js/dist/collapse.js.map
vendored
2
js/dist/collapse.js.map
vendored
File diff suppressed because one or more lines are too long
37
js/dist/dropdown.js
vendored
37
js/dist/dropdown.js
vendored
@ -22,16 +22,18 @@ var Dropdown = (function ($) {
|
|||||||
var NAME = 'dropdown';
|
var NAME = 'dropdown';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.dropdown';
|
var DATA_KEY = 'bs.dropdown';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.dropdown',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.dropdown',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.dropdown',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.dropdown',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.dropdown',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
KEYDOWN: 'keydown.bs.dropdown.data-api',
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
|
||||||
CLICK_DATA: 'click.bs.dropdown.data-api'
|
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -60,7 +62,9 @@ var Dropdown = (function ($) {
|
|||||||
function Dropdown(element) {
|
function Dropdown(element) {
|
||||||
_classCallCheck(this, Dropdown);
|
_classCallCheck(this, Dropdown);
|
||||||
|
|
||||||
$(element).on(Event.CLICK, this.toggle);
|
this._element = element;
|
||||||
|
|
||||||
|
this._addEventListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
_createClass(Dropdown, [{
|
_createClass(Dropdown, [{
|
||||||
@ -108,6 +112,21 @@ var Dropdown = (function ($) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: '_addEventListeners',
|
||||||
|
|
||||||
|
// private
|
||||||
|
|
||||||
|
value: function _addEventListeners() {
|
||||||
|
$(this._element).on(Event.CLICK, this.toggle);
|
||||||
|
}
|
||||||
}], [{
|
}], [{
|
||||||
key: 'VERSION',
|
key: 'VERSION',
|
||||||
|
|
||||||
@ -240,7 +259,7 @@ var Dropdown = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.KEYDOWN, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA, Dropdown._clearMenus).on(Event.CLICK_DATA, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA, Selector.FORM_CHILD, function (e) {
|
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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
62
js/dist/modal.js
vendored
62
js/dist/modal.js
vendored
@ -22,6 +22,8 @@ var Modal = (function ($) {
|
|||||||
var NAME = 'modal';
|
var NAME = 'modal';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.modal';
|
var DATA_KEY = 'bs.modal';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 300;
|
var TRANSITION_DURATION = 300;
|
||||||
var BACKDROP_TRANSITION_DURATION = 150;
|
var BACKDROP_TRANSITION_DURATION = 150;
|
||||||
@ -33,17 +35,17 @@ var Modal = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.modal',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.modal',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.modal',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.modal',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
DISMISS: 'click.dismiss.bs.modal',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
KEYDOWN: 'keydown.dismiss.bs.modal',
|
RESIZE: 'resize' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.modal',
|
CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
|
||||||
RESIZE: 'resize.bs.modal',
|
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.modal.data-api',
|
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
|
||||||
MOUSEDOWN: 'mousedown.dismiss.bs.modal',
|
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
|
||||||
MOUSEUP: 'mouseup.dismiss.bs.modal'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -114,10 +116,10 @@ var Modal = (function ($) {
|
|||||||
this._setEscapeEvent();
|
this._setEscapeEvent();
|
||||||
this._setResizeEvent();
|
this._setResizeEvent();
|
||||||
|
|
||||||
$(this._element).on(Event.DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
||||||
|
|
||||||
$(this._dialog).on(Event.MOUSEDOWN, function () {
|
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
||||||
$(_this._element).one(Event.MOUSEUP, function (event) {
|
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
||||||
if ($(event.target).is(_this._element)) {
|
if ($(event.target).is(_this._element)) {
|
||||||
that._ignoreBackdropClick = true;
|
that._ignoreBackdropClick = true;
|
||||||
}
|
}
|
||||||
@ -150,8 +152,8 @@ var Modal = (function ($) {
|
|||||||
|
|
||||||
$(this._element).removeClass(ClassName.IN);
|
$(this._element).removeClass(ClassName.IN);
|
||||||
|
|
||||||
$(this._element).off(Event.DISMISS);
|
$(this._element).off(Event.CLICK_DISMISS);
|
||||||
$(this._dialog).off(Event.MOUSEDOWN);
|
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
||||||
|
|
||||||
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
||||||
|
|
||||||
@ -160,6 +162,26 @@ var Modal = (function ($) {
|
|||||||
this._hideModal();
|
this._hideModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
|
||||||
|
$(window).off(EVENT_KEY);
|
||||||
|
$(document).off(EVENT_KEY);
|
||||||
|
$(this._element).off(EVENT_KEY);
|
||||||
|
$(this._backdrop).off(EVENT_KEY);
|
||||||
|
|
||||||
|
this._config = null;
|
||||||
|
this._element = null;
|
||||||
|
this._dialog = null;
|
||||||
|
this._backdrop = null;
|
||||||
|
this._isShown = null;
|
||||||
|
this._isBodyOverflowing = null;
|
||||||
|
this._ignoreBackdropClick = null;
|
||||||
|
this._originalBodyPadding = null;
|
||||||
|
this._scrollbarWidth = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_showElement',
|
key: '_showElement',
|
||||||
|
|
||||||
@ -219,13 +241,13 @@ var Modal = (function ($) {
|
|||||||
var _this4 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
if (this._isShown && this._config.keyboard) {
|
if (this._isShown && this._config.keyboard) {
|
||||||
$(this._element).on(Event.KEYDOWN, function (event) {
|
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
_this4.hide();
|
_this4.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!this._isShown) {
|
} else if (!this._isShown) {
|
||||||
$(this._element).off(Event.KEYDOWN);
|
$(this._element).off(Event.KEYDOWN_DISMISS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -277,7 +299,7 @@ var Modal = (function ($) {
|
|||||||
|
|
||||||
$(this._backdrop).appendTo(this.$body);
|
$(this._backdrop).appendTo(this.$body);
|
||||||
|
|
||||||
$(this._element).on(Event.DISMISS, function (event) {
|
$(this._element).on(Event.CLICK_DISMISS, function (event) {
|
||||||
if (_this6._ignoreBackdropClick) {
|
if (_this6._ignoreBackdropClick) {
|
||||||
_this6._ignoreBackdropClick = false;
|
_this6._ignoreBackdropClick = false;
|
||||||
return;
|
return;
|
||||||
@ -442,7 +464,7 @@ var Modal = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
var _this7 = this;
|
var _this7 = this;
|
||||||
|
|
||||||
var target = undefined;
|
var target = undefined;
|
||||||
|
2
js/dist/modal.js.map
vendored
2
js/dist/modal.js.map
vendored
File diff suppressed because one or more lines are too long
26
js/dist/popover.js
vendored
26
js/dist/popover.js
vendored
@ -24,6 +24,7 @@ var Popover = (function ($) {
|
|||||||
var NAME = 'popover';
|
var NAME = 'popover';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.popover';
|
var DATA_KEY = 'bs.popover';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Default = $.extend({}, Tooltip.Default, {
|
var Default = $.extend({}, Tooltip.Default, {
|
||||||
@ -45,16 +46,16 @@ var Popover = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.popover',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.popover',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.popover',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.popover',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
INSERTED: 'inserted.bs.popover',
|
INSERTED: 'inserted' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.popover',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.popover',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
FOCUSOUT: 'focusout.bs.popover',
|
FOCUSOUT: 'focusout' + EVENT_KEY,
|
||||||
MOUSEENTER: 'mouseenter.bs.popover',
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
MOUSELEAVE: 'mouseleave.bs.popover'
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,6 +143,11 @@ var Popover = (function ($) {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return Event;
|
return Event;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'EVENT_KEY',
|
||||||
|
get: function () {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_jQueryInterface',
|
key: '_jQueryInterface',
|
||||||
|
|
||||||
|
2
js/dist/popover.js.map
vendored
2
js/dist/popover.js.map
vendored
File diff suppressed because one or more lines are too long
26
js/dist/scrollspy.js
vendored
26
js/dist/scrollspy.js
vendored
@ -22,6 +22,8 @@ var ScrollSpy = (function ($) {
|
|||||||
var NAME = 'scrollspy';
|
var NAME = 'scrollspy';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.scrollspy';
|
var DATA_KEY = 'bs.scrollspy';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
@ -29,9 +31,9 @@ var ScrollSpy = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
ACTIVATE: 'activate.bs.scrollspy',
|
ACTIVATE: 'activate' + EVENT_KEY,
|
||||||
SCROLL: 'scroll.bs.scrollspy',
|
SCROLL: 'scroll' + EVENT_KEY,
|
||||||
LOAD: 'load.bs.scrollspy.data-api'
|
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -56,6 +58,7 @@ var ScrollSpy = (function ($) {
|
|||||||
function ScrollSpy(element, config) {
|
function ScrollSpy(element, config) {
|
||||||
_classCallCheck(this, ScrollSpy);
|
_classCallCheck(this, ScrollSpy);
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||||
this._config = $.extend({}, Default, config);
|
this._config = $.extend({}, Default, config);
|
||||||
this._selector = '' + (this._config.target || '') + ' .nav li > a';
|
this._selector = '' + (this._config.target || '') + ' .nav li > a';
|
||||||
@ -114,6 +117,21 @@ var ScrollSpy = (function ($) {
|
|||||||
_this._targets.push(item[1]);
|
_this._targets.push(item[1]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY);
|
||||||
|
$(this._scrollElement).off(EVENT_KEY);
|
||||||
|
|
||||||
|
this._element = null;
|
||||||
|
this._scrollElement = null;
|
||||||
|
this._config = null;
|
||||||
|
this._selector = null;
|
||||||
|
this._offsets = null;
|
||||||
|
this._targets = null;
|
||||||
|
this._activeTarget = null;
|
||||||
|
this._scrollHeight = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_getScrollTop',
|
key: '_getScrollTop',
|
||||||
|
|
||||||
@ -240,7 +258,7 @@ var ScrollSpy = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
||||||
|
|
||||||
for (var i = scrollSpys.length; i--;) {
|
for (var i = scrollSpys.length; i--;) {
|
||||||
|
2
js/dist/scrollspy.js.map
vendored
2
js/dist/scrollspy.js.map
vendored
File diff suppressed because one or more lines are too long
20
js/dist/tab.js
vendored
20
js/dist/tab.js
vendored
@ -22,15 +22,17 @@ var Tab = (function ($) {
|
|||||||
var NAME = 'tab';
|
var NAME = 'tab';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.tab';
|
var DATA_KEY = 'bs.tab';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.tab',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.tab',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.tab',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.tab',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.tab.data-api'
|
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -134,6 +136,12 @@ var Tab = (function ($) {
|
|||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'dispose',
|
||||||
|
value: function dispose() {
|
||||||
|
$.removeClass(this._element, DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_activate',
|
key: '_activate',
|
||||||
|
|
||||||
@ -247,7 +255,7 @@ var Tab = (function ($) {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
Tab._jQueryInterface.call($(this), 'show');
|
Tab._jQueryInterface.call($(this), 'show');
|
||||||
});
|
});
|
||||||
|
2
js/dist/tab.js.map
vendored
2
js/dist/tab.js.map
vendored
File diff suppressed because one or more lines are too long
85
js/dist/tooltip.js
vendored
85
js/dist/tooltip.js
vendored
@ -22,6 +22,7 @@ var Tooltip = (function ($) {
|
|||||||
var NAME = 'tooltip';
|
var NAME = 'tooltip';
|
||||||
var VERSION = '4.0.0';
|
var VERSION = '4.0.0';
|
||||||
var DATA_KEY = 'bs.tooltip';
|
var DATA_KEY = 'bs.tooltip';
|
||||||
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
var TRANSITION_DURATION = 150;
|
var TRANSITION_DURATION = 150;
|
||||||
var CLASS_PREFIX = 'bs-tether';
|
var CLASS_PREFIX = 'bs-tether';
|
||||||
@ -52,16 +53,16 @@ var Tooltip = (function ($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
HIDE: 'hide.bs.tooltip',
|
HIDE: 'hide' + EVENT_KEY,
|
||||||
HIDDEN: 'hidden.bs.tooltip',
|
HIDDEN: 'hidden' + EVENT_KEY,
|
||||||
SHOW: 'show.bs.tooltip',
|
SHOW: 'show' + EVENT_KEY,
|
||||||
SHOWN: 'shown.bs.tooltip',
|
SHOWN: 'shown' + EVENT_KEY,
|
||||||
INSERTED: 'inserted.bs.tooltip',
|
INSERTED: 'inserted' + EVENT_KEY,
|
||||||
CLICK: 'click.bs.tooltip',
|
CLICK: 'click' + EVENT_KEY,
|
||||||
FOCUSIN: 'focusin.bs.tooltip',
|
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||||
FOCUSOUT: 'focusout.bs.tooltip',
|
FOCUSOUT: 'focusout' + EVENT_KEY,
|
||||||
MOUSEENTER: 'mouseenter.bs.tooltip',
|
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||||
MOUSELEAVE: 'mouseleave.bs.tooltip'
|
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
||||||
};
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
@ -155,25 +156,34 @@ var Tooltip = (function ($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'destroy',
|
key: 'dispose',
|
||||||
value: function destroy() {
|
value: function dispose() {
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
clearTimeout(this._timeout);
|
clearTimeout(this._timeout);
|
||||||
this.hide(function () {
|
|
||||||
$(_this.element).off('.' + _this.constructor.NAME).removeData(_this.constructor.DATA_KEY);
|
|
||||||
|
|
||||||
if (_this.tip) {
|
this.cleanupTether();
|
||||||
$(_this.tip).detach();
|
|
||||||
|
$.removeData(this.element, this.constructor.DATA_KEY);
|
||||||
|
|
||||||
|
$(this.element).off(this.constructor.EVENT_KEY);
|
||||||
|
|
||||||
|
if (this.tip) {
|
||||||
|
$(this.tip).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
_this.tip = null;
|
this._isEnabled = null;
|
||||||
});
|
this._timeout = null;
|
||||||
|
this._hoverState = null;
|
||||||
|
this._activeTrigger = null;
|
||||||
|
this._tether = null;
|
||||||
|
|
||||||
|
this.element = null;
|
||||||
|
this.config = null;
|
||||||
|
this.tip = null;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'show',
|
key: 'show',
|
||||||
value: function show() {
|
value: function show() {
|
||||||
var _this2 = this;
|
var _this = this;
|
||||||
|
|
||||||
var showEvent = $.Event(this.constructor.Event.SHOW);
|
var showEvent = $.Event(this.constructor.Event.SHOW);
|
||||||
|
|
||||||
@ -222,13 +232,13 @@ var Tooltip = (function ($) {
|
|||||||
$(tip).addClass(ClassName.IN);
|
$(tip).addClass(ClassName.IN);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
var prevHoverState = _this2._hoverState;
|
var prevHoverState = _this._hoverState;
|
||||||
_this2._hoverState = null;
|
_this._hoverState = null;
|
||||||
|
|
||||||
$(_this2.element).trigger(_this2.constructor.Event.SHOWN);
|
$(_this.element).trigger(_this.constructor.Event.SHOWN);
|
||||||
|
|
||||||
if (prevHoverState === HoverState.OUT) {
|
if (prevHoverState === HoverState.OUT) {
|
||||||
_this2._leave(null, _this2);
|
_this._leave(null, _this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -238,18 +248,18 @@ var Tooltip = (function ($) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'hide',
|
key: 'hide',
|
||||||
value: function hide(callback) {
|
value: function hide(callback) {
|
||||||
var _this3 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
if (_this3._hoverState !== HoverState.IN && tip.parentNode) {
|
if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
|
||||||
tip.parentNode.removeChild(tip);
|
tip.parentNode.removeChild(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
_this3.element.removeAttribute('aria-describedby');
|
_this2.element.removeAttribute('aria-describedby');
|
||||||
$(_this3.element).trigger(_this3.constructor.Event.HIDDEN);
|
$(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
|
||||||
_this3.cleanupTether();
|
_this2.cleanupTether();
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
@ -334,18 +344,18 @@ var Tooltip = (function ($) {
|
|||||||
}, {
|
}, {
|
||||||
key: '_setListeners',
|
key: '_setListeners',
|
||||||
value: function _setListeners() {
|
value: function _setListeners() {
|
||||||
var _this4 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
var triggers = this.config.trigger.split(' ');
|
var triggers = this.config.trigger.split(' ');
|
||||||
|
|
||||||
triggers.forEach(function (trigger) {
|
triggers.forEach(function (trigger) {
|
||||||
if (trigger === 'click') {
|
if (trigger === 'click') {
|
||||||
$(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, $.proxy(_this4.toggle, _this4));
|
$(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3));
|
||||||
} else if (trigger !== Trigger.MANUAL) {
|
} else if (trigger !== Trigger.MANUAL) {
|
||||||
var eventIn = trigger == Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
|
var eventIn = trigger == Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
|
||||||
var eventOut = trigger == Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
|
var eventOut = trigger == Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
|
||||||
|
|
||||||
$(_this4.element).on(eventIn, _this4.config.selector, $.proxy(_this4._enter, _this4)).on(eventOut, _this4.config.selector, $.proxy(_this4._leave, _this4));
|
$(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -512,6 +522,11 @@ var Tooltip = (function ($) {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return Event;
|
return Event;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'EVENT_KEY',
|
||||||
|
get: function () {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_jQueryInterface',
|
key: '_jQueryInterface',
|
||||||
|
|
||||||
|
2
js/dist/tooltip.js.map
vendored
2
js/dist/tooltip.js.map
vendored
File diff suppressed because one or more lines are too long
@ -20,6 +20,8 @@ const Alert = (($) => {
|
|||||||
const NAME = 'alert'
|
const NAME = 'alert'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.alert'
|
const DATA_KEY = 'bs.alert'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
const DATA_API_KEY = '.data-api'
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
const TRANSITION_DURATION = 150
|
const TRANSITION_DURATION = 150
|
||||||
|
|
||||||
@ -28,9 +30,9 @@ const Alert = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
CLOSE : 'close.bs.alert',
|
CLOSE : `close${EVENT_KEY}`,
|
||||||
CLOSED : 'closed.bs.alert',
|
CLOSED : `closed${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.alert.data-api'
|
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -75,6 +77,11 @@ const Alert = (($) => {
|
|||||||
this._removeElement(rootElement)
|
this._removeElement(rootElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY)
|
||||||
|
this._element = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
||||||
@ -159,7 +166,7 @@ const Alert = (($) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(
|
$(document).on(
|
||||||
Event.CLICK,
|
Event.CLICK_DATA_API,
|
||||||
Selector.DISMISS,
|
Selector.DISMISS,
|
||||||
Alert._handleDismiss(new Alert())
|
Alert._handleDismiss(new Alert())
|
||||||
)
|
)
|
||||||
|
@ -17,6 +17,8 @@ const Button = (($) => {
|
|||||||
const NAME = 'button'
|
const NAME = 'button'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.button'
|
const DATA_KEY = 'bs.button'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
const DATA_API_KEY = '.data-api'
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
const TRANSITION_DURATION = 150
|
const TRANSITION_DURATION = 150
|
||||||
|
|
||||||
@ -35,8 +37,9 @@ const Button = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
CLICK : 'click.bs.button.data-api',
|
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`,
|
||||||
FOCUS_BLUR : 'focus.bs.button.data-api blur.bs.button.data-api'
|
FOCUS_BLUR_DATA_API : `focus${EVENT_KEY}${DATA_API_KEY} `
|
||||||
|
+ `blur${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,6 +104,11 @@ const Button = (($) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY)
|
||||||
|
this._element = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
||||||
@ -129,7 +137,7 @@ const Button = (($) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on(Event.CLICK, Selector.DATA_TOGGLE_CARROT, function (event) {
|
.on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
let button = event.target
|
let button = event.target
|
||||||
@ -140,7 +148,7 @@ const Button = (($) => {
|
|||||||
|
|
||||||
Button._jQueryInterface.call($(button), 'toggle')
|
Button._jQueryInterface.call($(button), 'toggle')
|
||||||
})
|
})
|
||||||
.on(Event.FOCUS_BLUR, Selector.DATA_TOGGLE_CARROT, function (event) {
|
.on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
var button = $(event.target).closest(Selector.BUTTON)[0]
|
var button = $(event.target).closest(Selector.BUTTON)[0]
|
||||||
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type))
|
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type))
|
||||||
})
|
})
|
||||||
|
@ -20,6 +20,8 @@ const Carousel = (($) => {
|
|||||||
const NAME = 'carousel'
|
const NAME = 'carousel'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.carousel'
|
const DATA_KEY = 'bs.carousel'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
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
|
||||||
|
|
||||||
@ -37,10 +39,13 @@ const Carousel = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
SLIDE : 'slide.bs.carousel',
|
SLIDE : `slide${EVENT_KEY}`,
|
||||||
SLID : 'slid.bs.carousel',
|
SLID : `slid${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.carousel.data-api',
|
KEYDOWN : `keydown${EVENT_KEY}`,
|
||||||
LOAD : 'load'
|
MOUSEENTER : `mouseenter${EVENT_KEY}`,
|
||||||
|
MOUSELEAVE : `mouseleave${EVENT_KEY}`,
|
||||||
|
LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}`,
|
||||||
|
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -171,20 +176,34 @@ const Carousel = (($) => {
|
|||||||
this._slide(direction, this._items[index])
|
this._slide(direction, this._items[index])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$(this._element).off(EVENT_KEY)
|
||||||
|
$.removeData(this._element, DATA_KEY)
|
||||||
|
|
||||||
|
this._items = null
|
||||||
|
this._config = null
|
||||||
|
this._element = null
|
||||||
|
this._interval = null
|
||||||
|
this._isPaused = null
|
||||||
|
this._isSliding = null
|
||||||
|
this._activeElement = null
|
||||||
|
this._indicatorsElement = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
||||||
_addEventListeners() {
|
_addEventListeners() {
|
||||||
if (this._config.keyboard) {
|
if (this._config.keyboard) {
|
||||||
$(this._element)
|
$(this._element)
|
||||||
.on('keydown.bs.carousel', $.proxy(this._keydown, this))
|
.on(Event.KEYDOWN, $.proxy(this._keydown, this))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.pause == 'hover' &&
|
if (this._config.pause == 'hover' &&
|
||||||
!('ontouchstart' in document.documentElement)) {
|
!('ontouchstart' in document.documentElement)) {
|
||||||
$(this._element)
|
$(this._element)
|
||||||
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
|
.on(Event.MOUSEENTER, $.proxy(this.pause, this))
|
||||||
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
|
.on(Event.MOUSELEAVE, $.proxy(this.cycle, this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,9 +424,9 @@ const Carousel = (($) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on(Event.CLICK, Selector.DATA_SLIDE, Carousel._dataApiClickHandler)
|
.on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler)
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
$(Selector.DATA_RIDE).each(function () {
|
$(Selector.DATA_RIDE).each(function () {
|
||||||
let $carousel = $(this)
|
let $carousel = $(this)
|
||||||
Carousel._jQueryInterface.call($carousel, $carousel.data())
|
Carousel._jQueryInterface.call($carousel, $carousel.data())
|
||||||
|
@ -20,6 +20,8 @@ const Collapse = (($) => {
|
|||||||
const NAME = 'collapse'
|
const NAME = 'collapse'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.collapse'
|
const DATA_KEY = 'bs.collapse'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
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
|
||||||
|
|
||||||
@ -29,11 +31,11 @@ const Collapse = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
SHOW : 'show.bs.collapse',
|
SHOW : `show${EVENT_KEY}`,
|
||||||
SHOWN : 'shown.bs.collapse',
|
SHOWN : `shown${EVENT_KEY}`,
|
||||||
HIDE : 'hide.bs.collapse',
|
HIDE : `hide${EVENT_KEY}`,
|
||||||
HIDDEN : 'hidden.bs.collapse',
|
HIDDEN : `hidden${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.collapse.data-api'
|
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -110,8 +112,8 @@ const Collapse = (($) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let activesData
|
|
||||||
let actives
|
let actives
|
||||||
|
let activesData
|
||||||
|
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
actives = $.makeArray($(Selector.ACTIVES))
|
actives = $.makeArray($(Selector.ACTIVES))
|
||||||
@ -244,6 +246,16 @@ const Collapse = (($) => {
|
|||||||
this._isTransitioning = isTransitioning
|
this._isTransitioning = isTransitioning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY)
|
||||||
|
|
||||||
|
this._config = null
|
||||||
|
this._parent = null
|
||||||
|
this._element = null
|
||||||
|
this._triggerArray = null
|
||||||
|
this._isTransitioning = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
||||||
@ -323,7 +335,7 @@ const Collapse = (($) => {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
let target = Collapse._getTargetFromElement(this)
|
let target = Collapse._getTargetFromElement(this)
|
||||||
|
@ -20,16 +20,18 @@ const Dropdown = (($) => {
|
|||||||
const NAME = 'dropdown'
|
const NAME = 'dropdown'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.dropdown'
|
const DATA_KEY = 'bs.dropdown'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
const DATA_API_KEY = '.data-api'
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
HIDE : 'hide.bs.dropdown',
|
HIDE : `hide${EVENT_KEY}`,
|
||||||
HIDDEN : 'hidden.bs.dropdown',
|
HIDDEN : `hidden${EVENT_KEY}`,
|
||||||
SHOW : 'show.bs.dropdown',
|
SHOW : `show${EVENT_KEY}`,
|
||||||
SHOWN : 'shown.bs.dropdown',
|
SHOWN : `shown${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.dropdown',
|
CLICK : `click${EVENT_KEY}`,
|
||||||
KEYDOWN : 'keydown.bs.dropdown.data-api',
|
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`,
|
||||||
CLICK_DATA : 'click.bs.dropdown.data-api'
|
KEYDOWN_DATA_API : `keydown${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -59,7 +61,9 @@ const Dropdown = (($) => {
|
|||||||
class Dropdown {
|
class Dropdown {
|
||||||
|
|
||||||
constructor(element) {
|
constructor(element) {
|
||||||
$(element).on(Event.CLICK, this.toggle)
|
this._element = element
|
||||||
|
|
||||||
|
this._addEventListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,6 +118,19 @@ const Dropdown = (($) => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY)
|
||||||
|
$(this._element).off(EVENT_KEY)
|
||||||
|
this._element = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// private
|
||||||
|
|
||||||
|
_addEventListeners() {
|
||||||
|
$(this._element).on(Event.CLICK, this.toggle)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
||||||
@ -239,12 +256,12 @@ const Dropdown = (($) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on(Event.KEYDOWN, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler)
|
.on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler)
|
||||||
.on(Event.KEYDOWN, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler)
|
.on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler)
|
||||||
.on(Event.KEYDOWN, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler)
|
.on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler)
|
||||||
.on(Event.CLICK_DATA, Dropdown._clearMenus)
|
.on(Event.CLICK_DATA_API, Dropdown._clearMenus)
|
||||||
.on(Event.CLICK_DATA, Selector.DATA_TOGGLE, Dropdown.prototype.toggle)
|
.on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle)
|
||||||
.on(Event.CLICK_DATA, Selector.FORM_CHILD, function (e) {
|
.on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ const Modal = (($) => {
|
|||||||
const NAME = 'modal'
|
const NAME = 'modal'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.modal'
|
const DATA_KEY = 'bs.modal'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
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
|
||||||
@ -31,17 +33,17 @@ const Modal = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
HIDE : 'hide.bs.modal',
|
HIDE : `hide${EVENT_KEY}`,
|
||||||
HIDDEN : 'hidden.bs.modal',
|
HIDDEN : `hidden${EVENT_KEY}`,
|
||||||
SHOW : 'show.bs.modal',
|
SHOW : `show${EVENT_KEY}`,
|
||||||
SHOWN : 'shown.bs.modal',
|
SHOWN : `shown${EVENT_KEY}`,
|
||||||
DISMISS : 'click.dismiss.bs.modal',
|
FOCUSIN : `focusin${EVENT_KEY}`,
|
||||||
KEYDOWN : 'keydown.dismiss.bs.modal',
|
RESIZE : `resize${EVENT_KEY}`,
|
||||||
FOCUSIN : 'focusin.bs.modal',
|
CLICK_DISMISS : `click.dismiss${EVENT_KEY}`,
|
||||||
RESIZE : 'resize.bs.modal',
|
KEYDOWN_DISMISS : `keydown.dismiss${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.modal.data-api',
|
MOUSEUP_DISMISS : `mouseup.dismiss${EVENT_KEY}`,
|
||||||
MOUSEDOWN : 'mousedown.dismiss.bs.modal',
|
MOUSEDOWN_DISMISS : `mousedown.dismiss${EVENT_KEY}`,
|
||||||
MOUSEUP : 'mouseup.dismiss.bs.modal'
|
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -119,13 +121,13 @@ const Modal = (($) => {
|
|||||||
this._setResizeEvent()
|
this._setResizeEvent()
|
||||||
|
|
||||||
$(this._element).on(
|
$(this._element).on(
|
||||||
Event.DISMISS,
|
Event.CLICK_DISMISS,
|
||||||
Selector.DATA_DISMISS,
|
Selector.DATA_DISMISS,
|
||||||
$.proxy(this.hide, this)
|
$.proxy(this.hide, this)
|
||||||
)
|
)
|
||||||
|
|
||||||
$(this._dialog).on(Event.MOUSEDOWN, () => {
|
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, () => {
|
||||||
$(this._element).one(Event.MOUSEUP, (event) => {
|
$(this._element).one(Event.MOUSEUP_DISMISS, (event) => {
|
||||||
if ($(event.target).is(this._element)) {
|
if ($(event.target).is(this._element)) {
|
||||||
that._ignoreBackdropClick = true
|
that._ignoreBackdropClick = true
|
||||||
}
|
}
|
||||||
@ -159,8 +161,8 @@ const Modal = (($) => {
|
|||||||
|
|
||||||
$(this._element).removeClass(ClassName.IN)
|
$(this._element).removeClass(ClassName.IN)
|
||||||
|
|
||||||
$(this._element).off(Event.DISMISS)
|
$(this._element).off(Event.CLICK_DISMISS)
|
||||||
$(this._dialog).off(Event.MOUSEDOWN)
|
$(this._dialog).off(Event.MOUSEDOWN_DISMISS)
|
||||||
|
|
||||||
if (Util.supportsTransitionEnd() &&
|
if (Util.supportsTransitionEnd() &&
|
||||||
($(this._element).hasClass(ClassName.FADE))) {
|
($(this._element).hasClass(ClassName.FADE))) {
|
||||||
@ -173,6 +175,25 @@ const Modal = (($) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY)
|
||||||
|
|
||||||
|
$(window).off(EVENT_KEY)
|
||||||
|
$(document).off(EVENT_KEY)
|
||||||
|
$(this._element).off(EVENT_KEY)
|
||||||
|
$(this._backdrop).off(EVENT_KEY)
|
||||||
|
|
||||||
|
this._config = null
|
||||||
|
this._element = null
|
||||||
|
this._dialog = null
|
||||||
|
this._backdrop = null
|
||||||
|
this._isShown = null
|
||||||
|
this._isBodyOverflowing = null
|
||||||
|
this._ignoreBackdropClick = null
|
||||||
|
this._originalBodyPadding = null
|
||||||
|
this._scrollbarWidth = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
||||||
@ -228,14 +249,14 @@ const Modal = (($) => {
|
|||||||
|
|
||||||
_setEscapeEvent() {
|
_setEscapeEvent() {
|
||||||
if (this._isShown && this._config.keyboard) {
|
if (this._isShown && this._config.keyboard) {
|
||||||
$(this._element).on(Event.KEYDOWN, (event) => {
|
$(this._element).on(Event.KEYDOWN_DISMISS, (event) => {
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
this.hide()
|
this.hide()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (!this._isShown) {
|
} else if (!this._isShown) {
|
||||||
$(this._element).off(Event.KEYDOWN)
|
$(this._element).off(Event.KEYDOWN_DISMISS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +301,7 @@ const Modal = (($) => {
|
|||||||
|
|
||||||
$(this._backdrop).appendTo(this.$body)
|
$(this._backdrop).appendTo(this.$body)
|
||||||
|
|
||||||
$(this._element).on(Event.DISMISS, (event) => {
|
$(this._element).on(Event.CLICK_DISMISS, (event) => {
|
||||||
if (this._ignoreBackdropClick) {
|
if (this._ignoreBackdropClick) {
|
||||||
this._ignoreBackdropClick = false
|
this._ignoreBackdropClick = false
|
||||||
return
|
return
|
||||||
@ -440,7 +461,7 @@ const Modal = (($) => {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
let target
|
let target
|
||||||
let selector = Util.getSelectorFromElement(this)
|
let selector = Util.getSelectorFromElement(this)
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ const Popover = (($) => {
|
|||||||
const NAME = 'popover'
|
const NAME = 'popover'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.popover'
|
const DATA_KEY = 'bs.popover'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
|
|
||||||
const Default = $.extend({}, Tooltip.Default, {
|
const Default = $.extend({}, Tooltip.Default, {
|
||||||
@ -44,16 +45,16 @@ const Popover = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
HIDE : 'hide.bs.popover',
|
HIDE : `hide${EVENT_KEY}`,
|
||||||
HIDDEN : 'hidden.bs.popover',
|
HIDDEN : `hidden${EVENT_KEY}`,
|
||||||
SHOW : 'show.bs.popover',
|
SHOW : `show${EVENT_KEY}`,
|
||||||
SHOWN : 'shown.bs.popover',
|
SHOWN : `shown${EVENT_KEY}`,
|
||||||
INSERTED : 'inserted.bs.popover',
|
INSERTED : `inserted${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.popover',
|
CLICK : `click${EVENT_KEY}`,
|
||||||
FOCUSIN : 'focusin.bs.popover',
|
FOCUSIN : `focusin${EVENT_KEY}`,
|
||||||
FOCUSOUT : 'focusout.bs.popover',
|
FOCUSOUT : `focusout${EVENT_KEY}`,
|
||||||
MOUSEENTER : 'mouseenter.bs.popover',
|
MOUSEENTER : `mouseenter${EVENT_KEY}`,
|
||||||
MOUSELEAVE : 'mouseleave.bs.popover'
|
MOUSELEAVE : `mouseleave${EVENT_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -88,6 +89,10 @@ const Popover = (($) => {
|
|||||||
return Event
|
return Event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get EVENT_KEY() {
|
||||||
|
return EVENT_KEY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// overrides
|
// overrides
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ const ScrollSpy = (($) => {
|
|||||||
const NAME = 'scrollspy'
|
const NAME = 'scrollspy'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.scrollspy'
|
const DATA_KEY = 'bs.scrollspy'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
const DATA_API_KEY = '.data-api'
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
@ -27,9 +29,9 @@ const ScrollSpy = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
ACTIVATE : 'activate.bs.scrollspy',
|
ACTIVATE : `activate${EVENT_KEY}`,
|
||||||
SCROLL : 'scroll.bs.scrollspy',
|
SCROLL : `scroll${EVENT_KEY}`,
|
||||||
LOAD : 'load.bs.scrollspy.data-api'
|
LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -54,6 +56,7 @@ const ScrollSpy = (($) => {
|
|||||||
class ScrollSpy {
|
class ScrollSpy {
|
||||||
|
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
|
this._element = element
|
||||||
this._scrollElement = element.tagName === 'BODY' ? window : element
|
this._scrollElement = element.tagName === 'BODY' ? window : element
|
||||||
this._config = $.extend({}, Default, config)
|
this._config = $.extend({}, Default, config)
|
||||||
this._selector = `${this._config.target || ''} .nav li > a`
|
this._selector = `${this._config.target || ''} .nav li > a`
|
||||||
@ -123,6 +126,20 @@ const ScrollSpy = (($) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$.removeData(this._element, DATA_KEY)
|
||||||
|
$(this._scrollElement).off(EVENT_KEY)
|
||||||
|
|
||||||
|
this._element = null
|
||||||
|
this._scrollElement = null
|
||||||
|
this._config = null
|
||||||
|
this._selector = null
|
||||||
|
this._offsets = null
|
||||||
|
this._targets = null
|
||||||
|
this._activeTarget = null
|
||||||
|
this._scrollHeight = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
||||||
@ -244,7 +261,7 @@ const ScrollSpy = (($) => {
|
|||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(window).on(Event.LOAD, function () {
|
$(window).on(Event.LOAD_DATA_API, function () {
|
||||||
let scrollSpys = $.makeArray($(Selector.DATA_SPY))
|
let scrollSpys = $.makeArray($(Selector.DATA_SPY))
|
||||||
|
|
||||||
for (let i = scrollSpys.length; i--;) {
|
for (let i = scrollSpys.length; i--;) {
|
||||||
|
@ -20,15 +20,17 @@ const Tab = (($) => {
|
|||||||
const NAME = 'tab'
|
const NAME = 'tab'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.tab'
|
const DATA_KEY = 'bs.tab'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
|
const DATA_API_KEY = '.data-api'
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
const TRANSITION_DURATION = 150
|
const TRANSITION_DURATION = 150
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
HIDE : 'hide.bs.tab',
|
HIDE : `hide${EVENT_KEY}`,
|
||||||
HIDDEN : 'hidden.bs.tab',
|
HIDDEN : `hidden${EVENT_KEY}`,
|
||||||
SHOW : 'show.bs.tab',
|
SHOW : `show${EVENT_KEY}`,
|
||||||
SHOWN : 'shown.bs.tab',
|
SHOWN : `shown${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.tab.data-api'
|
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -146,6 +148,11 @@ const Tab = (($) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
$.removeClass(this._element, DATA_KEY)
|
||||||
|
this._element = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
||||||
@ -258,7 +265,7 @@ const Tab = (($) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on(Event.CLICK, Selector.DATA_TOGGLE, function (event) {
|
.on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
Tab._jQueryInterface.call($(this), 'show')
|
Tab._jQueryInterface.call($(this), 'show')
|
||||||
})
|
})
|
||||||
|
@ -20,6 +20,7 @@ const Tooltip = (($) => {
|
|||||||
const NAME = 'tooltip'
|
const NAME = 'tooltip'
|
||||||
const VERSION = '4.0.0'
|
const VERSION = '4.0.0'
|
||||||
const DATA_KEY = 'bs.tooltip'
|
const DATA_KEY = 'bs.tooltip'
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
const TRANSITION_DURATION = 150
|
const TRANSITION_DURATION = 150
|
||||||
const CLASS_PREFIX = 'bs-tether'
|
const CLASS_PREFIX = 'bs-tether'
|
||||||
@ -52,16 +53,16 @@ const Tooltip = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
HIDE : 'hide.bs.tooltip',
|
HIDE : `hide${EVENT_KEY}`,
|
||||||
HIDDEN : 'hidden.bs.tooltip',
|
HIDDEN : `hidden${EVENT_KEY}`,
|
||||||
SHOW : 'show.bs.tooltip',
|
SHOW : `show${EVENT_KEY}`,
|
||||||
SHOWN : 'shown.bs.tooltip',
|
SHOWN : `shown${EVENT_KEY}`,
|
||||||
INSERTED : 'inserted.bs.tooltip',
|
INSERTED : `inserted${EVENT_KEY}`,
|
||||||
CLICK : 'click.bs.tooltip',
|
CLICK : `click${EVENT_KEY}`,
|
||||||
FOCUSIN : 'focusin.bs.tooltip',
|
FOCUSIN : `focusin${EVENT_KEY}`,
|
||||||
FOCUSOUT : 'focusout.bs.tooltip',
|
FOCUSOUT : `focusout${EVENT_KEY}`,
|
||||||
MOUSEENTER : 'mouseenter.bs.tooltip',
|
MOUSEENTER : `mouseenter${EVENT_KEY}`,
|
||||||
MOUSELEAVE : 'mouseleave.bs.tooltip'
|
MOUSELEAVE : `mouseleave${EVENT_KEY}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassName = {
|
const ClassName = {
|
||||||
@ -136,6 +137,9 @@ const Tooltip = (($) => {
|
|||||||
return Event
|
return Event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get EVENT_KEY() {
|
||||||
|
return EVENT_KEY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// public
|
// public
|
||||||
@ -182,19 +186,28 @@ const Tooltip = (($) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
dispose() {
|
||||||
clearTimeout(this._timeout)
|
clearTimeout(this._timeout)
|
||||||
this.hide(() => {
|
|
||||||
$(this.element)
|
this.cleanupTether()
|
||||||
.off(`.${this.constructor.NAME}`)
|
|
||||||
.removeData(this.constructor.DATA_KEY)
|
$.removeData(this.element, this.constructor.DATA_KEY)
|
||||||
|
|
||||||
|
$(this.element).off(this.constructor.EVENT_KEY)
|
||||||
|
|
||||||
if (this.tip) {
|
if (this.tip) {
|
||||||
$(this.tip).detach()
|
$(this.tip).remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._isEnabled = null
|
||||||
|
this._timeout = null
|
||||||
|
this._hoverState = null
|
||||||
|
this._activeTrigger = null
|
||||||
|
this._tether = null
|
||||||
|
|
||||||
|
this.element = null
|
||||||
|
this.config = null
|
||||||
this.tip = null
|
this.tip = null
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
|
@ -179,7 +179,7 @@ $(function () {
|
|||||||
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover has extra click.foo event')
|
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover has extra click.foo event')
|
||||||
|
|
||||||
$popover.bootstrapPopover('show')
|
$popover.bootstrapPopover('show')
|
||||||
$popover.bootstrapPopover('destroy')
|
$popover.bootstrapPopover('dispose')
|
||||||
|
|
||||||
assert.ok(!$popover.hasClass('in'), 'popover is hidden')
|
assert.ok(!$popover.hasClass('in'), 'popover is hidden')
|
||||||
assert.ok(!$popover.data('popover'), 'popover does not have data')
|
assert.ok(!$popover.data('popover'), 'popover does not have data')
|
||||||
@ -231,7 +231,7 @@ $(function () {
|
|||||||
$div
|
$div
|
||||||
.one('shown.bs.popover', function () {
|
.one('shown.bs.popover', function () {
|
||||||
$('.content-with-handler .btn').trigger('click')
|
$('.content-with-handler .btn').trigger('click')
|
||||||
$div.bootstrapPopover('destroy')
|
$div.bootstrapPopover('dispose')
|
||||||
assert.ok(handlerCalled, 'content\'s event handler still present')
|
assert.ok(handlerCalled, 'content\'s event handler still present')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
@ -250,7 +250,7 @@ $(function () {
|
|||||||
assert.strictEqual($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip has extra click.foo event')
|
assert.strictEqual($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip has extra click.foo event')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('show')
|
$tooltip.bootstrapTooltip('show')
|
||||||
$tooltip.bootstrapTooltip('destroy')
|
$tooltip.bootstrapTooltip('dispose')
|
||||||
|
|
||||||
assert.ok(!$tooltip.hasClass('in'), 'tooltip is hidden')
|
assert.ok(!$tooltip.hasClass('in'), 'tooltip is hidden')
|
||||||
assert.ok(!$._data($tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
|
assert.ok(!$._data($tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user