Commit 11abb0f7 authored by Jacob Thornton's avatar Jacob Thornton

fix modal

parent 9bdb6d13
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
var Event = { var Event = {
CLOSE: 'close' + EVENT_KEY, CLOSE: 'close' + EVENT_KEY,
CLOSED: 'closed' + EVENT_KEY, CLOSED: 'closed' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -73,6 +73,14 @@ ...@@ -73,6 +73,14 @@
this._element = element; this._element = element;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Alert, [{ _createClass(Alert, [{
key: 'close', key: 'close',
...@@ -96,11 +104,11 @@ ...@@ -96,11 +104,11 @@
$.removeData(this._element, DATA_KEY); $.removeData(this._element, DATA_KEY);
this._element = null; this._element = null;
} }
}, {
key: '_getRootElement',
// private // private
}, {
key: '_getRootElement',
value: function _getRootElement(element) { value: function _getRootElement(element) {
var parent = false; var parent = false;
var selector = _Util['default'].getSelectorFromElement(element); var selector = _Util['default'].getSelectorFromElement(element);
...@@ -139,11 +147,11 @@ ...@@ -139,11 +147,11 @@
value: function _destroyElement(element) { value: function _destroyElement(element) {
$(element).detach().trigger(Event.CLOSED).remove(); $(element).detach().trigger(Event.CLOSED).remove();
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var $element = $(this); var $element = $(this);
...@@ -172,10 +180,7 @@ ...@@ -172,10 +180,7 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}]); }]);
...@@ -183,12 +188,6 @@ ...@@ -183,12 +188,6 @@
return Alert; return Alert;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
/** /**
......
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
}; };
var Event = { var Event = {
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY, CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + '' + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + '' + DATA_API_KEY) FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
}; };
/** /**
...@@ -72,6 +72,14 @@ ...@@ -72,6 +72,14 @@
this._element = element; this._element = element;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Button, [{ _createClass(Button, [{
key: 'toggle', key: 'toggle',
...@@ -116,11 +124,11 @@ ...@@ -116,11 +124,11 @@
$.removeData(this._element, DATA_KEY); $.removeData(this._element, DATA_KEY);
this._element = null; this._element = null;
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -137,10 +145,7 @@ ...@@ -137,10 +145,7 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}]); }]);
...@@ -148,12 +153,6 @@ ...@@ -148,12 +153,6 @@
return Button; return Button;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault(); event.preventDefault();
......
...@@ -71,8 +71,8 @@ ...@@ -71,8 +71,8 @@
KEYDOWN: 'keydown' + EVENT_KEY, KEYDOWN: 'keydown' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY, MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY, MOUSELEAVE: 'mouseleave' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY, LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -118,6 +118,14 @@ ...@@ -118,6 +118,14 @@
this._addEventListeners(); this._addEventListeners();
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Carousel, [{ _createClass(Carousel, [{
key: 'next', key: 'next',
...@@ -211,11 +219,11 @@ ...@@ -211,11 +219,11 @@
this._activeElement = null; this._activeElement = null;
this._indicatorsElement = null; this._indicatorsElement = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
_Util['default'].typeCheckConfig(NAME, config, DefaultType); _Util['default'].typeCheckConfig(NAME, config, DefaultType);
...@@ -371,11 +379,11 @@ ...@@ -371,11 +379,11 @@
this.cycle(); this.cycle();
} }
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -434,15 +442,12 @@ ...@@ -434,15 +442,12 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}]); }]);
...@@ -450,12 +455,6 @@ ...@@ -450,12 +455,6 @@
return Carousel; return Carousel;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$(window).on(Event.LOAD_DATA_API, function () { $(window).on(Event.LOAD_DATA_API, function () {
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
SHOWN: 'shown' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY,
HIDE: 'hide' + EVENT_KEY, HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY, HIDDEN: 'hidden' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -105,6 +105,14 @@ ...@@ -105,6 +105,14 @@
} }
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Collapse, [{ _createClass(Collapse, [{
key: 'toggle', key: 'toggle',
...@@ -251,11 +259,11 @@ ...@@ -251,11 +259,11 @@
this._triggerArray = null; this._triggerArray = null;
this._isTransitioning = null; this._isTransitioning = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
config.toggle = !!config.toggle; // coerce string values config.toggle = !!config.toggle; // coerce string values
...@@ -294,11 +302,11 @@ ...@@ -294,11 +302,11 @@
} }
} }
} }
}], [{
key: '_getTargetFromElement',
// static // static
}], [{
key: '_getTargetFromElement',
value: function _getTargetFromElement(element) { value: function _getTargetFromElement(element) {
var selector = _Util['default'].getSelectorFromElement(element); var selector = _Util['default'].getSelectorFromElement(element);
return selector ? $(selector)[0] : null; return selector ? $(selector)[0] : null;
...@@ -327,15 +335,12 @@ ...@@ -327,15 +335,12 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}]); }]);
...@@ -343,12 +348,6 @@ ...@@ -343,12 +348,6 @@
return Collapse; return Collapse;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault(); event.preventDefault();
......
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
SHOW: 'show' + EVENT_KEY, SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY,
CLICK: 'click' + EVENT_KEY, CLICK: 'click' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY, CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + '' + DATA_API_KEY KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -84,6 +84,14 @@ ...@@ -84,6 +84,14 @@
this._addEventListeners(); this._addEventListeners();
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Dropdown, [{ _createClass(Dropdown, [{
key: 'toggle', key: 'toggle',
...@@ -136,19 +144,19 @@ ...@@ -136,19 +144,19 @@
$(this._element).off(EVENT_KEY); $(this._element).off(EVENT_KEY);
this._element = null; this._element = null;
} }
}, {
key: '_addEventListeners',
// private // private
}, {
key: '_addEventListeners',
value: function _addEventListeners() { value: function _addEventListeners() {
$(this._element).on(Event.CLICK, this.toggle); $(this._element).on(Event.CLICK, this.toggle);
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -259,10 +267,7 @@ ...@@ -259,10 +267,7 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}]); }]);
...@@ -270,12 +275,6 @@ ...@@ -270,12 +275,6 @@
return Dropdown; return Dropdown;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(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) { $(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();
}); });
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY, KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY, MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY, MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -108,6 +108,14 @@ ...@@ -108,6 +108,14 @@
this._scrollbarWidth = 0; this._scrollbarWidth = 0;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Modal, [{ _createClass(Modal, [{
key: 'toggle', key: 'toggle',
...@@ -207,11 +215,11 @@ ...@@ -207,11 +215,11 @@
this._originalBodyPadding = null; this._originalBodyPadding = null;
this._scrollbarWidth = null; this._scrollbarWidth = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
_Util['default'].typeCheckConfig(NAME, config, DefaultType); _Util['default'].typeCheckConfig(NAME, config, DefaultType);
...@@ -329,7 +337,7 @@ ...@@ -329,7 +337,7 @@
$(this._backdrop).addClass(animate); $(this._backdrop).addClass(animate);
} }
$(this._backdrop).appendTo(this.$body); $(this._backdrop).appendTo(document.body);
$(this._element).on(Event.CLICK_DISMISS, function (event) { $(this._element).on(Event.CLICK_DISMISS, function (event) {
if (_this6._ignoreBackdropClick) { if (_this6._ignoreBackdropClick) {
...@@ -381,14 +389,14 @@ ...@@ -381,14 +389,14 @@
callback(); callback();
} }
} }
}, {
key: '_handleUpdate',
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// the following methods are used to handle overflowing modals // the following methods are used to handle overflowing modals
// todo (fat): these should probably be refactored out of modal.js // todo (fat): these should probably be refactored out of modal.js
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
}, {
key: '_handleUpdate',
value: function _handleUpdate() { value: function _handleUpdate() {
this._adjustDialog(); this._adjustDialog();
} }
...@@ -450,11 +458,11 @@ ...@@ -450,11 +458,11 @@
document.body.removeChild(scrollDiv); document.body.removeChild(scrollDiv);
return scrollbarWidth; return scrollbarWidth;
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config, relatedTarget) { value: function _jQueryInterface(config, relatedTarget) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -474,15 +482,12 @@ ...@@ -474,15 +482,12 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}]); }]);
...@@ -490,12 +495,6 @@ ...@@ -490,12 +495,6 @@
return Modal; return Modal;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
var _this7 = this; var _this7 = this;
......
...@@ -15,11 +15,13 @@ ...@@ -15,11 +15,13 @@
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _Tooltip2 = _interopRequireDefault(_tooltip); var _Tooltip2 = _interopRequireDefault(_tooltip);
...@@ -86,15 +88,19 @@ ...@@ -86,15 +88,19 @@
*/ */
var Popover = (function (_Tooltip) { var Popover = (function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() { function Popover() {
_classCallCheck(this, Popover); _classCallCheck(this, Popover);
if (_Tooltip != null) { _get(Object.getPrototypeOf(Popover.prototype), 'constructor', this).apply(this, arguments);
_Tooltip.apply(this, arguments);
}
} }
_inherits(Popover, _Tooltip); /**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Popover, [{ _createClass(Popover, [{
key: 'isWithContent', key: 'isWithContent',
...@@ -128,19 +134,19 @@ ...@@ -128,19 +134,19 @@
this.cleanupTether(); this.cleanupTether();
} }
}, {
key: '_getContent',
// private // private
}, {
key: '_getContent',
value: function _getContent() { value: function _getContent() {
return this.element.getAttribute('data-content') || (typeof this.config.content == 'function' ? this.config.content.call(this.element) : this.config.content); return this.element.getAttribute('data-content') || (typeof this.config.content == 'function' ? this.config.content.call(this.element) : this.config.content);
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -165,37 +171,37 @@ ...@@ -165,37 +171,37 @@
// getters // getters
get: function () { get: function get() {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}, { }, {
key: 'NAME', key: 'NAME',
get: function () { get: function get() {
return NAME; return NAME;
} }
}, { }, {
key: 'DATA_KEY', key: 'DATA_KEY',
get: function () { get: function get() {
return DATA_KEY; return DATA_KEY;
} }
}, { }, {
key: 'Event', key: 'Event',
get: function () { get: function get() {
return Event; return Event;
} }
}, { }, {
key: 'EVENT_KEY', key: 'EVENT_KEY',
get: function () { get: function get() {
return EVENT_KEY; return EVENT_KEY;
} }
}, { }, {
key: 'DefaultType', key: 'DefaultType',
get: function () { get: function get() {
return DefaultType; return DefaultType;
} }
}]); }]);
...@@ -203,12 +209,6 @@ ...@@ -203,12 +209,6 @@
return Popover; return Popover;
})(_Tooltip2['default']); })(_Tooltip2['default']);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Popover._jQueryInterface; $.fn[NAME] = Popover._jQueryInterface;
$.fn[NAME].Constructor = Popover; $.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = function () { $.fn[NAME].noConflict = function () {
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
var Event = { var Event = {
ACTIVATE: 'activate' + EVENT_KEY, ACTIVATE: 'activate' + EVENT_KEY,
SCROLL: 'scroll' + EVENT_KEY, SCROLL: 'scroll' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
this._element = element; this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element; this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._selector = '' + this._config.target + ' ' + Selector.NAV_ANCHORS; this._selector = this._config.target + ' ' + Selector.NAV_ANCHORS;
this._offsets = []; this._offsets = [];
this._targets = []; this._targets = [];
this._activeTarget = null; this._activeTarget = null;
...@@ -104,6 +104,14 @@ ...@@ -104,6 +104,14 @@
this._process(); this._process();
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(ScrollSpy, [{ _createClass(ScrollSpy, [{
key: 'refresh', key: 'refresh',
...@@ -161,11 +169,11 @@ ...@@ -161,11 +169,11 @@
this._activeTarget = null; this._activeTarget = null;
this._scrollHeight = null; this._scrollHeight = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
...@@ -232,7 +240,7 @@ ...@@ -232,7 +240,7 @@
this._clear(); this._clear();
var selector = '' + this._selector + '[data-target="' + target + '"],' + ('' + this._selector + '[href="' + target + '"]'); var selector = this._selector + '[data-target="' + target + '"],' + (this._selector + '[href="' + target + '"]');
// todo (fat): getting all the raw li's up the tree is not great. // todo (fat): getting all the raw li's up the tree is not great.
var parentListItems = $(selector).parents(Selector.LI); var parentListItems = $(selector).parents(Selector.LI);
...@@ -261,11 +269,11 @@ ...@@ -261,11 +269,11 @@
$(activeParents[i]).removeClass(ClassName.ACTIVE); $(activeParents[i]).removeClass(ClassName.ACTIVE);
} }
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -283,15 +291,12 @@ ...@@ -283,15 +291,12 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}]); }]);
...@@ -299,12 +304,6 @@ ...@@ -299,12 +304,6 @@
return ScrollSpy; return ScrollSpy;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(window).on(Event.LOAD_DATA_API, function () { $(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $.makeArray($(Selector.DATA_SPY)); var scrollSpys = $.makeArray($(Selector.DATA_SPY));
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
HIDDEN: 'hidden' + EVENT_KEY, HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY, SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -84,6 +84,14 @@ ...@@ -84,6 +84,14 @@
this._element = element; this._element = element;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tab, [{ _createClass(Tab, [{
key: 'show', key: 'show',
...@@ -159,11 +167,11 @@ ...@@ -159,11 +167,11 @@
$.removeClass(this._element, DATA_KEY); $.removeClass(this._element, DATA_KEY);
this._element = null; this._element = null;
} }
}, {
key: '_activate',
// private // private
}, {
key: '_activate',
value: function _activate(element, container, callback) { value: function _activate(element, container, callback) {
var active = $(container).find(Selector.ACTIVE_CHILD)[0]; var active = $(container).find(Selector.ACTIVE_CHILD)[0];
var isTransitioning = callback && _Util['default'].supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || !!$(container).find(Selector.FADE_CHILD)[0]); var isTransitioning = callback && _Util['default'].supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || !!$(container).find(Selector.FADE_CHILD)[0]);
...@@ -228,11 +236,11 @@ ...@@ -228,11 +236,11 @@
callback(); callback();
} }
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var $this = $(this); var $this = $(this);
...@@ -250,10 +258,7 @@ ...@@ -250,10 +258,7 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}]); }]);
...@@ -261,12 +266,6 @@ ...@@ -261,12 +266,6 @@
return Tab; return Tab;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, 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');
......
...@@ -142,6 +142,14 @@ ...@@ -142,6 +142,14 @@
this._setListeners(); this._setListeners();
} }
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tooltip, [{ _createClass(Tooltip, [{
key: 'enable', key: 'enable',
...@@ -313,11 +321,11 @@ ...@@ -313,11 +321,11 @@
this._hoverState = ''; this._hoverState = '';
} }
}, {
key: 'isWithContent',
// protected // protected
}, {
key: 'isWithContent',
value: function isWithContent() { value: function isWithContent() {
return !!this.getTitle(); return !!this.getTitle();
} }
...@@ -363,11 +371,11 @@ ...@@ -363,11 +371,11 @@
$(this.tip).removeClass(this._removeTetherClasses); $(this.tip).removeClass(this._removeTetherClasses);
} }
} }
}, {
key: '_getAttachment',
// private // private
}, {
key: '_getAttachment',
value: function _getAttachment(placement) { value: function _getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()]; return AttachmentMap[placement.toUpperCase()];
} }
...@@ -526,11 +534,11 @@ ...@@ -526,11 +534,11 @@
return config; return config;
} }
}], [{
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -552,40 +560,37 @@ ...@@ -552,40 +560,37 @@
} }
}, { }, {
key: 'VERSION', key: 'VERSION',
get: function get() {
// getters
get: function () {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}, { }, {
key: 'NAME', key: 'NAME',
get: function () { get: function get() {
return NAME; return NAME;
} }
}, { }, {
key: 'DATA_KEY', key: 'DATA_KEY',
get: function () { get: function get() {
return DATA_KEY; return DATA_KEY;
} }
}, { }, {
key: 'Event', key: 'Event',
get: function () { get: function get() {
return Event; return Event;
} }
}, { }, {
key: 'EVENT_KEY', key: 'EVENT_KEY',
get: function () { get: function get() {
return EVENT_KEY; return EVENT_KEY;
} }
}, { }, {
key: 'DefaultType', key: 'DefaultType',
get: function () { get: function get() {
return DefaultType; return DefaultType;
} }
}]); }]);
...@@ -593,12 +598,6 @@ ...@@ -593,12 +598,6 @@
return Tooltip; return Tooltip;
})(); })();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tooltip._jQueryInterface; $.fn[NAME] = Tooltip._jQueryInterface;
$.fn[NAME].Constructor = Tooltip; $.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = function () { $.fn[NAME].noConflict = function () {
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
if (value && isElement(value)) valueType = 'element';else valueType = toType(value); if (value && isElement(value)) valueType = 'element';else valueType = toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error('' + componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".')); throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
} }
} }
} }
......
...@@ -172,19 +172,23 @@ Use the tab JavaScript plugin—include it individually or through the compiled ...@@ -172,19 +172,23 @@ Use the tab JavaScript plugin—include it individually or through the compiled
<div class="bd-example bd-example-tabs" role="tabpanel"> <div class="bd-example bd-example-tabs" role="tabpanel">
<ul id="myTab" class="nav nav-tabs" role="tablist"> <ul id="myTab" class="nav nav-tabs" role="tablist">
<li class="active"> <li class="nav-item active">
<a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">Home</a> <a class="nav-link" href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">Home</a>
</li> </li>
<li> <li class="nav-item">
<a href="#profile" role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile">Profile</a> <a class="nav-link" href="#profile" role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile">Profile</a>
</li> </li>
<li class="dropdown"> <li class="nav-item dropdown">
<a href="#" id="myTabDrop1" class="dropdown-toggle" data-toggle="dropdown" aria-controls="myTabDrop1-contents"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Dropdown Dropdown
</a> </a>
<ul class="dropdown-menu" aria-labelledby="myTabDrop1" id="myTabDrop1-contents"> <ul class="dropdown-menu">
<li><a href="#dropdown1" role="tab" id="dropdown1-tab" data-toggle="tab" aria-controls="dropdown1">@fat</a></li> <li>
<li><a href="#dropdown2" role="tab" id="dropdown2-tab" data-toggle="tab" aria-controls="dropdown2">@mdo</a></li> <a href="#dropdown1" role="tab" id="dropdown1-tab" data-toggle="tab" aria-controls="dropdown1">@fat</a>
</li>
<li>
<a href="#dropdown2" role="tab" id="dropdown2-tab" data-toggle="tab" aria-controls="dropdown2">@mdo</a>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
...@@ -212,10 +216,18 @@ You can activate a tab or pill navigation without writing any JavaScript by simp ...@@ -212,10 +216,18 @@ You can activate a tab or pill navigation without writing any JavaScript by simp
{% highlight html %} {% highlight html %}
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#home" role="tab" data-toggle="tab">Home</a></li> <li class="nav-item active">
<li><a href="#profile" role="tab" data-toggle="tab">Profile</a></li> <a class="nav-link" href="#home" role="tab" data-toggle="tab">Home</a>
<li><a href="#messages" role="tab" data-toggle="tab">Messages</a></li> </li>
<li><a href="#settings" role="tab" data-toggle="tab">Settings</a></li> <li class="nav-item">
<a class="nav-link" href="#profile" role="tab" data-toggle="tab">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#messages" role="tab" data-toggle="tab">Messages</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#settings" role="tab" data-toggle="tab">Settings</a>
</li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
...@@ -269,17 +281,17 @@ Activates a tab element and content container. Tab should have either a `data-ta ...@@ -269,17 +281,17 @@ Activates a tab element and content container. Tab should have either a `data-ta
{% highlight html %} {% highlight html %}
<ul class="nav nav-tabs" role="tablist" id="myTab"> <ul class="nav nav-tabs" role="tablist" id="myTab">
<li class="active"> <li class="nav-item active">
<a href="#home" role="tab" data-toggle="tab" aria-controls="home">Home</a> <a class="nav-link" href="#home" role="tab" data-toggle="tab" aria-controls="home">Home</a>
</li> </li>
<li> <li class="nav-item">
<a href="#profile" role="tab" data-toggle="tab" aria-controls="profile">Profile</a> <a class="nav-link" href="#profile" role="tab" data-toggle="tab" aria-controls="profile">Profile</a>
</li> </li>
<li> <li class="nav-item">
<a href="#messages" role="tab" data-toggle="tab" aria-controls="messages">Messages</a> <a class="nav-link" href="#messages" role="tab" data-toggle="tab" aria-controls="messages">Messages</a>
</li> </li>
<li> <li class="nav-item">
<a href="#settings" role="tab" data-toggle="tab" aria-controls="settings">Settings</a> <a class="nav-link" href="#settings" role="tab" data-toggle="tab" aria-controls="settings">Settings</a>
</li> </li>
</ul> </ul>
......
...@@ -257,12 +257,16 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap ...@@ -257,12 +257,16 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<td>How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. `manual` cannot be combined with any other trigger.</td> <td>How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. `manual` cannot be combined with any other trigger.</td>
</tr> </tr>
<tr> <tr>
<td>viewport</td> <td>constraints</td>
<td>string | object</td> <td>Array</td>
<td>{ selector: 'body', padding: 0 }</td> <td>'hover focus'</td>
<td> <td>An array of constraints - passed through to tether. For more information refer to tether's <a href="http://github.hubspot.com/tether/#constraints">constraint docs</a>.</td>
<p>Keeps the popover within the bounds of this element. Example: <code>viewport: '#viewport'</code> or <code>{ "selector": "#viewport", "padding": 0 }</code></p> </tr>
</td> <tr>
<td>offsets</td>
<td>string</td>
<td>'0 0'</td>
<td>Offset of the popover relative to it's target. For more information refer to tether's <a href="http://github.hubspot.com/tether/#constraints">offset docs</a>.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -13,7 +13,7 @@ Inspired by the excellent Tipsy jQuery plugin written by Jason Frame. Tooltips a ...@@ -13,7 +13,7 @@ Inspired by the excellent Tipsy jQuery plugin written by Jason Frame. Tooltips a
## Overview ## Overview
Things to know when using the popover plugin: Things to know when using the tooltip plugin:
- Tooltips are opt-in for performance reasons, so **you must initialize them yourself**. - Tooltips are opt-in for performance reasons, so **you must initialize them yourself**.
- Tooltips with zero-length titles are never displayed. - Tooltips with zero-length titles are never displayed.
...@@ -24,7 +24,7 @@ Things to know when using the popover plugin: ...@@ -24,7 +24,7 @@ Things to know when using the popover plugin:
Got all that? Great, let's see how they work with some examples. Got all that? Great, let's see how they work with some examples.
## Example: Enable popovers everywhere ## Example: Enable tooltips everywhere
One way to initialize all tooltips on a page would be to select them by their `data-toggle` attribute: One way to initialize all tooltips on a page would be to select them by their `data-toggle` attribute:
...@@ -216,12 +216,16 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap ...@@ -216,12 +216,16 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<td>How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. `manual` cannot be combined with any other trigger.</td> <td>How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. `manual` cannot be combined with any other trigger.</td>
</tr> </tr>
<tr> <tr>
<td>viewport</td> <td>constraints</td>
<td>string | object</td> <td>Array</td>
<td>{ selector: 'body', padding: 0 }</td> <td>'hover focus'</td>
<td> <td>An array of constraints - passed through to tether. For more information refer to tether's <a href="http://github.hubspot.com/tether/#constraints">constraint docs</a>.</td>
<p>Keeps the tooltip within the bounds of this element. Example: <code>viewport: '#viewport'</code> or <code>{ "selector": "#viewport", "padding": 0 }</code></p> </tr>
</td> <tr>
<td>offsets</td>
<td>string</td>
<td>'0 0'</td>
<td>Offset of the popover relative to it's target. For more information refer to tether's <a href="http://github.hubspot.com/tether/#constraints">offset docs</a>.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -34,7 +34,7 @@ var Alert = (function ($) { ...@@ -34,7 +34,7 @@ var Alert = (function ($) {
var Event = { var Event = {
CLOSE: 'close' + EVENT_KEY, CLOSE: 'close' + EVENT_KEY,
CLOSED: 'closed' + EVENT_KEY, CLOSED: 'closed' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -56,6 +56,14 @@ var Alert = (function ($) { ...@@ -56,6 +56,14 @@ var Alert = (function ($) {
this._element = element; this._element = element;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Alert, [{ _createClass(Alert, [{
key: 'close', key: 'close',
...@@ -79,11 +87,11 @@ var Alert = (function ($) { ...@@ -79,11 +87,11 @@ var Alert = (function ($) {
$.removeData(this._element, DATA_KEY); $.removeData(this._element, DATA_KEY);
this._element = null; this._element = null;
} }
}, {
key: '_getRootElement',
// private // private
}, {
key: '_getRootElement',
value: function _getRootElement(element) { value: function _getRootElement(element) {
var parent = false; var parent = false;
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
...@@ -122,19 +130,11 @@ var Alert = (function ($) { ...@@ -122,19 +130,11 @@ var Alert = (function ($) {
value: function _destroyElement(element) { value: function _destroyElement(element) {
$(element).detach().trigger(Event.CLOSED).remove(); $(element).detach().trigger(Event.CLOSED).remove();
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var $element = $(this); var $element = $(this);
...@@ -161,17 +161,16 @@ var Alert = (function ($) { ...@@ -161,17 +161,16 @@ var Alert = (function ($) {
alertInstance.close(this); alertInstance.close(this);
}; };
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]); }]);
return Alert; return Alert;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
/** /**
......
This diff was suppressed by a .gitattributes entry.
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v4.0.0): button.js * Bootstrap (v4.0.0): button.js
...@@ -11,6 +5,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons ...@@ -11,6 +5,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var Button = (function ($) { var Button = (function ($) {
/** /**
...@@ -42,8 +42,8 @@ var Button = (function ($) { ...@@ -42,8 +42,8 @@ var Button = (function ($) {
}; };
var Event = { var Event = {
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY, CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + '' + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + '' + DATA_API_KEY) FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
}; };
/** /**
...@@ -59,6 +59,14 @@ var Button = (function ($) { ...@@ -59,6 +59,14 @@ var Button = (function ($) {
this._element = element; this._element = element;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Button, [{ _createClass(Button, [{
key: 'toggle', key: 'toggle',
...@@ -103,19 +111,11 @@ var Button = (function ($) { ...@@ -103,19 +111,11 @@ var Button = (function ($) {
$.removeData(this._element, DATA_KEY); $.removeData(this._element, DATA_KEY);
this._element = null; this._element = null;
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -130,17 +130,16 @@ var Button = (function ($) { ...@@ -130,17 +130,16 @@ var Button = (function ($) {
} }
}); });
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]); }]);
return Button; return Button;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault(); event.preventDefault();
......
This diff was suppressed by a .gitattributes entry.
...@@ -54,8 +54,8 @@ var Carousel = (function ($) { ...@@ -54,8 +54,8 @@ var Carousel = (function ($) {
KEYDOWN: 'keydown' + EVENT_KEY, KEYDOWN: 'keydown' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY, MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY, MOUSELEAVE: 'mouseleave' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY, LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -101,6 +101,14 @@ var Carousel = (function ($) { ...@@ -101,6 +101,14 @@ var Carousel = (function ($) {
this._addEventListeners(); this._addEventListeners();
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Carousel, [{ _createClass(Carousel, [{
key: 'next', key: 'next',
...@@ -194,11 +202,11 @@ var Carousel = (function ($) { ...@@ -194,11 +202,11 @@ var Carousel = (function ($) {
this._activeElement = null; this._activeElement = null;
this._indicatorsElement = null; this._indicatorsElement = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
Util.typeCheckConfig(NAME, config, DefaultType); Util.typeCheckConfig(NAME, config, DefaultType);
...@@ -354,24 +362,11 @@ var Carousel = (function ($) { ...@@ -354,24 +362,11 @@ var Carousel = (function ($) {
this.cycle(); this.cycle();
} }
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: 'Default',
get: function () {
return Default;
}
}, {
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -428,17 +423,21 @@ var Carousel = (function ($) { ...@@ -428,17 +423,21 @@ var Carousel = (function ($) {
event.preventDefault(); event.preventDefault();
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]); }]);
return Carousel; return Carousel;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$(window).on(Event.LOAD_DATA_API, function () { $(window).on(Event.LOAD_DATA_API, function () {
......
This diff was suppressed by a .gitattributes entry.
...@@ -42,7 +42,7 @@ var Collapse = (function ($) { ...@@ -42,7 +42,7 @@ var Collapse = (function ($) {
SHOWN: 'shown' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY,
HIDE: 'hide' + EVENT_KEY, HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY, HIDDEN: 'hidden' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -88,6 +88,14 @@ var Collapse = (function ($) { ...@@ -88,6 +88,14 @@ var Collapse = (function ($) {
} }
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Collapse, [{ _createClass(Collapse, [{
key: 'toggle', key: 'toggle',
...@@ -234,11 +242,11 @@ var Collapse = (function ($) { ...@@ -234,11 +242,11 @@ var Collapse = (function ($) {
this._triggerArray = null; this._triggerArray = null;
this._isTransitioning = null; this._isTransitioning = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
config.toggle = !!config.toggle; // coerce string values config.toggle = !!config.toggle; // coerce string values
...@@ -277,24 +285,11 @@ var Collapse = (function ($) { ...@@ -277,24 +285,11 @@ var Collapse = (function ($) {
} }
} }
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: 'Default',
get: function () {
return Default;
}
}, {
key: '_getTargetFromElement',
// static // static
}], [{
key: '_getTargetFromElement',
value: function _getTargetFromElement(element) { value: function _getTargetFromElement(element) {
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
return selector ? $(selector)[0] : null; return selector ? $(selector)[0] : null;
...@@ -321,17 +316,21 @@ var Collapse = (function ($) { ...@@ -321,17 +316,21 @@ var Collapse = (function ($) {
} }
}); });
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]); }]);
return Collapse; return Collapse;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault(); event.preventDefault();
......
This diff was suppressed by a .gitattributes entry.
...@@ -32,8 +32,8 @@ var Dropdown = (function ($) { ...@@ -32,8 +32,8 @@ var Dropdown = (function ($) {
SHOW: 'show' + EVENT_KEY, SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY,
CLICK: 'click' + EVENT_KEY, CLICK: 'click' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY, CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + '' + DATA_API_KEY KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -67,6 +67,14 @@ var Dropdown = (function ($) { ...@@ -67,6 +67,14 @@ var Dropdown = (function ($) {
this._addEventListeners(); this._addEventListeners();
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Dropdown, [{ _createClass(Dropdown, [{
key: 'toggle', key: 'toggle',
...@@ -119,27 +127,19 @@ var Dropdown = (function ($) { ...@@ -119,27 +127,19 @@ var Dropdown = (function ($) {
$(this._element).off(EVENT_KEY); $(this._element).off(EVENT_KEY);
this._element = null; this._element = null;
} }
}, {
key: '_addEventListeners',
// private // private
}, {
key: '_addEventListeners',
value: function _addEventListeners() { value: function _addEventListeners() {
$(this._element).on(Event.CLICK, this.toggle); $(this._element).on(Event.CLICK, this.toggle);
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -248,17 +248,16 @@ var Dropdown = (function ($) { ...@@ -248,17 +248,16 @@ var Dropdown = (function ($) {
items[index].focus(); items[index].focus();
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]); }]);
return Dropdown; return Dropdown;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(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) { $(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();
}); });
......
This diff was suppressed by a .gitattributes entry.
...@@ -53,7 +53,7 @@ var Modal = (function ($) { ...@@ -53,7 +53,7 @@ var Modal = (function ($) {
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY, KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY, MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY, MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -91,6 +91,14 @@ var Modal = (function ($) { ...@@ -91,6 +91,14 @@ var Modal = (function ($) {
this._scrollbarWidth = 0; this._scrollbarWidth = 0;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Modal, [{ _createClass(Modal, [{
key: 'toggle', key: 'toggle',
...@@ -190,11 +198,11 @@ var Modal = (function ($) { ...@@ -190,11 +198,11 @@ var Modal = (function ($) {
this._originalBodyPadding = null; this._originalBodyPadding = null;
this._scrollbarWidth = null; this._scrollbarWidth = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
Util.typeCheckConfig(NAME, config, DefaultType); Util.typeCheckConfig(NAME, config, DefaultType);
...@@ -312,7 +320,7 @@ var Modal = (function ($) { ...@@ -312,7 +320,7 @@ var Modal = (function ($) {
$(this._backdrop).addClass(animate); $(this._backdrop).addClass(animate);
} }
$(this._backdrop).appendTo(this.$body); $(this._backdrop).appendTo(document.body);
$(this._element).on(Event.CLICK_DISMISS, function (event) { $(this._element).on(Event.CLICK_DISMISS, function (event) {
if (_this6._ignoreBackdropClick) { if (_this6._ignoreBackdropClick) {
...@@ -364,14 +372,14 @@ var Modal = (function ($) { ...@@ -364,14 +372,14 @@ var Modal = (function ($) {
callback(); callback();
} }
} }
}, {
key: '_handleUpdate',
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// the following methods are used to handle overflowing modals // the following methods are used to handle overflowing modals
// todo (fat): these should probably be refactored out of modal.js // todo (fat): these should probably be refactored out of modal.js
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
}, {
key: '_handleUpdate',
value: function _handleUpdate() { value: function _handleUpdate() {
this._adjustDialog(); this._adjustDialog();
} }
...@@ -433,24 +441,11 @@ var Modal = (function ($) { ...@@ -433,24 +441,11 @@ var Modal = (function ($) {
document.body.removeChild(scrollDiv); document.body.removeChild(scrollDiv);
return scrollbarWidth; return scrollbarWidth;
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: 'Default',
get: function () {
return Default;
}
}, {
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config, relatedTarget) { value: function _jQueryInterface(config, relatedTarget) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -468,17 +463,21 @@ var Modal = (function ($) { ...@@ -468,17 +463,21 @@ var Modal = (function ($) {
} }
}); });
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]); }]);
return Modal; return Modal;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
var _this7 = this; var _this7 = this;
......
This diff was suppressed by a .gitattributes entry.
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
...@@ -69,15 +71,19 @@ var Popover = (function ($) { ...@@ -69,15 +71,19 @@ var Popover = (function ($) {
*/ */
var Popover = (function (_Tooltip) { var Popover = (function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() { function Popover() {
_classCallCheck(this, Popover); _classCallCheck(this, Popover);
if (_Tooltip != null) { _get(Object.getPrototypeOf(Popover.prototype), 'constructor', this).apply(this, arguments);
_Tooltip.apply(this, arguments);
}
} }
_inherits(Popover, _Tooltip); /**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Popover, [{ _createClass(Popover, [{
key: 'isWithContent', key: 'isWithContent',
...@@ -111,87 +117,81 @@ var Popover = (function ($) { ...@@ -111,87 +117,81 @@ var Popover = (function ($) {
this.cleanupTether(); this.cleanupTether();
} }
}, {
key: '_getContent',
// private // private
}, {
key: '_getContent',
value: function _getContent() { value: function _getContent() {
return this.element.getAttribute('data-content') || (typeof this.config.content == 'function' ? this.config.content.call(this.element) : this.config.content); return this.element.getAttribute('data-content') || (typeof this.config.content == 'function' ? this.config.content.call(this.element) : this.config.content);
} }
// static
}], [{ }], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = typeof config === 'object' ? config : null;
if (!data && /destroy|hide/.test(config)) {
return;
}
if (!data) {
data = new Popover(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
data[config]();
}
});
}
}, {
key: 'VERSION', key: 'VERSION',
// getters // getters
get: function () { get: function get() {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}, { }, {
key: 'NAME', key: 'NAME',
get: function () { get: function get() {
return NAME; return NAME;
} }
}, { }, {
key: 'DATA_KEY', key: 'DATA_KEY',
get: function () { get: function get() {
return DATA_KEY; return DATA_KEY;
} }
}, { }, {
key: 'Event', key: 'Event',
get: function () { get: function get() {
return Event; return Event;
} }
}, { }, {
key: 'EVENT_KEY', key: 'EVENT_KEY',
get: function () { get: function get() {
return EVENT_KEY; return EVENT_KEY;
} }
}, { }, {
key: 'DefaultType', key: 'DefaultType',
get: function () { get: function get() {
return DefaultType; return DefaultType;
} }
}, {
key: '_jQueryInterface',
// static
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = typeof config === 'object' ? config : null;
if (!data && /destroy|hide/.test(config)) {
return;
}
if (!data) {
data = new Popover(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
data[config]();
}
});
}
}]); }]);
return Popover; return Popover;
})(Tooltip); })(Tooltip);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Popover._jQueryInterface; $.fn[NAME] = Popover._jQueryInterface;
$.fn[NAME].Constructor = Popover; $.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = function () { $.fn[NAME].noConflict = function () {
......
This diff was suppressed by a .gitattributes entry.
...@@ -41,7 +41,7 @@ var ScrollSpy = (function ($) { ...@@ -41,7 +41,7 @@ var ScrollSpy = (function ($) {
var Event = { var Event = {
ACTIVATE: 'activate' + EVENT_KEY, ACTIVATE: 'activate' + EVENT_KEY,
SCROLL: 'scroll' + EVENT_KEY, SCROLL: 'scroll' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -75,7 +75,7 @@ var ScrollSpy = (function ($) { ...@@ -75,7 +75,7 @@ var ScrollSpy = (function ($) {
this._element = element; this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element; this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._selector = '' + this._config.target + ' ' + Selector.NAV_ANCHORS; this._selector = this._config.target + ' ' + Selector.NAV_ANCHORS;
this._offsets = []; this._offsets = [];
this._targets = []; this._targets = [];
this._activeTarget = null; this._activeTarget = null;
...@@ -87,6 +87,14 @@ var ScrollSpy = (function ($) { ...@@ -87,6 +87,14 @@ var ScrollSpy = (function ($) {
this._process(); this._process();
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(ScrollSpy, [{ _createClass(ScrollSpy, [{
key: 'refresh', key: 'refresh',
...@@ -144,11 +152,11 @@ var ScrollSpy = (function ($) { ...@@ -144,11 +152,11 @@ var ScrollSpy = (function ($) {
this._activeTarget = null; this._activeTarget = null;
this._scrollHeight = null; this._scrollHeight = null;
} }
}, {
key: '_getConfig',
// private // private
}, {
key: '_getConfig',
value: function _getConfig(config) { value: function _getConfig(config) {
config = $.extend({}, Default, config); config = $.extend({}, Default, config);
...@@ -215,7 +223,7 @@ var ScrollSpy = (function ($) { ...@@ -215,7 +223,7 @@ var ScrollSpy = (function ($) {
this._clear(); this._clear();
var selector = '' + this._selector + '[data-target="' + target + '"],' + ('' + this._selector + '[href="' + target + '"]'); var selector = this._selector + '[data-target="' + target + '"],' + (this._selector + '[href="' + target + '"]');
// todo (fat): getting all the raw li's up the tree is not great. // todo (fat): getting all the raw li's up the tree is not great.
var parentListItems = $(selector).parents(Selector.LI); var parentListItems = $(selector).parents(Selector.LI);
...@@ -244,24 +252,11 @@ var ScrollSpy = (function ($) { ...@@ -244,24 +252,11 @@ var ScrollSpy = (function ($) {
$(activeParents[i]).removeClass(ClassName.ACTIVE); $(activeParents[i]).removeClass(ClassName.ACTIVE);
} }
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: 'Default',
get: function () {
return Default;
}
}, {
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var data = $(this).data(DATA_KEY); var data = $(this).data(DATA_KEY);
...@@ -277,17 +272,21 @@ var ScrollSpy = (function ($) { ...@@ -277,17 +272,21 @@ var ScrollSpy = (function ($) {
} }
}); });
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]); }]);
return ScrollSpy; return ScrollSpy;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(window).on(Event.LOAD_DATA_API, function () { $(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $.makeArray($(Selector.DATA_SPY)); var scrollSpys = $.makeArray($(Selector.DATA_SPY));
......
This diff was suppressed by a .gitattributes entry.
...@@ -32,7 +32,7 @@ var Tab = (function ($) { ...@@ -32,7 +32,7 @@ var Tab = (function ($) {
HIDDEN: 'hidden' + EVENT_KEY, HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY, SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
}; };
var ClassName = { var ClassName = {
...@@ -67,6 +67,14 @@ var Tab = (function ($) { ...@@ -67,6 +67,14 @@ var Tab = (function ($) {
this._element = element; this._element = element;
} }
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tab, [{ _createClass(Tab, [{
key: 'show', key: 'show',
...@@ -142,11 +150,11 @@ var Tab = (function ($) { ...@@ -142,11 +150,11 @@ var Tab = (function ($) {
$.removeClass(this._element, DATA_KEY); $.removeClass(this._element, DATA_KEY);
this._element = null; this._element = null;
} }
}, {
key: '_activate',
// private // private
}, {
key: '_activate',
value: function _activate(element, container, callback) { value: function _activate(element, container, callback) {
var active = $(container).find(Selector.ACTIVE_CHILD)[0]; var active = $(container).find(Selector.ACTIVE_CHILD)[0];
var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || !!$(container).find(Selector.FADE_CHILD)[0]); var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || !!$(container).find(Selector.FADE_CHILD)[0]);
...@@ -211,19 +219,11 @@ var Tab = (function ($) { ...@@ -211,19 +219,11 @@ var Tab = (function ($) {
callback(); callback();
} }
} }
}], [{
key: 'VERSION',
// getters
get: function () {
return VERSION;
}
}, {
key: '_jQueryInterface',
// static // static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) { value: function _jQueryInterface(config) {
return this.each(function () { return this.each(function () {
var $this = $(this); var $this = $(this);
...@@ -239,17 +239,16 @@ var Tab = (function ($) { ...@@ -239,17 +239,16 @@ var Tab = (function ($) {
} }
}); });
} }
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]); }]);
return Tab; return Tab;
})(); })();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, 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');
......
This diff was suppressed by a .gitattributes entry.
...@@ -125,6 +125,14 @@ var Tooltip = (function ($) { ...@@ -125,6 +125,14 @@ var Tooltip = (function ($) {
this._setListeners(); this._setListeners();
} }
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tooltip, [{ _createClass(Tooltip, [{
key: 'enable', key: 'enable',
...@@ -296,11 +304,11 @@ var Tooltip = (function ($) { ...@@ -296,11 +304,11 @@ var Tooltip = (function ($) {
this._hoverState = ''; this._hoverState = '';
} }
}, {
key: 'isWithContent',
// protected // protected
}, {
key: 'isWithContent',
value: function isWithContent() { value: function isWithContent() {
return !!this.getTitle(); return !!this.getTitle();
} }
...@@ -346,11 +354,11 @@ var Tooltip = (function ($) { ...@@ -346,11 +354,11 @@ var Tooltip = (function ($) {
$(this.tip).removeClass(this._removeTetherClasses); $(this.tip).removeClass(this._removeTetherClasses);
} }
} }
}, {
key: '_getAttachment',
// private // private
}, {
key: '_getAttachment',
value: function _getAttachment(placement) { value: function _getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()]; return AttachmentMap[placement.toUpperCase()];
} }
...@@ -509,79 +517,70 @@ var Tooltip = (function ($) { ...@@ -509,79 +517,70 @@ var Tooltip = (function ($) {
return config; return config;
} }
// static
}], [{ }], [{
key: 'VERSION', key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = typeof config === 'object' ? config : null;
// getters if (!data && /destroy|hide/.test(config)) {
return;
}
get: function () { if (!data) {
data = new Tooltip(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
data[config]();
}
});
}
}, {
key: 'VERSION',
get: function get() {
return VERSION; return VERSION;
} }
}, { }, {
key: 'Default', key: 'Default',
get: function () { get: function get() {
return Default; return Default;
} }
}, { }, {
key: 'NAME', key: 'NAME',
get: function () { get: function get() {
return NAME; return NAME;
} }
}, { }, {
key: 'DATA_KEY', key: 'DATA_KEY',
get: function () { get: function get() {
return DATA_KEY; return DATA_KEY;
} }
}, { }, {
key: 'Event', key: 'Event',
get: function () { get: function get() {
return Event; return Event;
} }
}, { }, {
key: 'EVENT_KEY', key: 'EVENT_KEY',
get: function () { get: function get() {
return EVENT_KEY; return EVENT_KEY;
} }
}, { }, {
key: 'DefaultType', key: 'DefaultType',
get: function () { get: function get() {
return DefaultType; return DefaultType;
} }
}, {
key: '_jQueryInterface',
// static
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = typeof config === 'object' ? config : null;
if (!data && /destroy|hide/.test(config)) {
return;
}
if (!data) {
data = new Tooltip(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
data[config]();
}
});
}
}]); }]);
return Tooltip; return Tooltip;
})(); })();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tooltip._jQueryInterface; $.fn[NAME] = Tooltip._jQueryInterface;
$.fn[NAME].Constructor = Tooltip; $.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = function () { $.fn[NAME].noConflict = function () {
......
This diff was suppressed by a .gitattributes entry.
...@@ -137,7 +137,7 @@ var Util = (function ($) { ...@@ -137,7 +137,7 @@ var Util = (function ($) {
if (value && isElement(value)) valueType = 'element';else valueType = toType(value); if (value && isElement(value)) valueType = 'element';else valueType = toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error('' + componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".')); throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
} }
} }
} }
......
This diff was suppressed by a .gitattributes entry.
...@@ -313,7 +313,7 @@ const Modal = (($) => { ...@@ -313,7 +313,7 @@ const Modal = (($) => {
$(this._backdrop).addClass(animate) $(this._backdrop).addClass(animate)
} }
$(this._backdrop).appendTo(this.$body) $(this._backdrop).appendTo(document.body)
$(this._element).on(Event.CLICK_DISMISS, (event) => { $(this._element).on(Event.CLICK_DISMISS, (event) => {
if (this._ignoreBackdropClick) { if (this._ignoreBackdropClick) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment