diff options
author | Mark Otto <markdotto@gmail.com> | 2016-10-10 03:26:51 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2016-10-10 03:26:51 +0300 |
commit | 571e86e7705ee38a4b828b0e6f24de089a69e8a9 (patch) | |
tree | 6fa1e44c68d2e18720694a34803475e172f42b64 /js/dist/button.js | |
parent | 6def7a5d56c5042a6f91361842f85f5af6e5b033 (diff) |
grunt
Diffstat (limited to 'js/dist/button.js')
-rw-r--r-- | js/dist/button.js | 125 |
1 files changed, 59 insertions, 66 deletions
diff --git a/js/dist/button.js b/js/dist/button.js index 2d791ed1fe..20f532fc9f 100644 --- a/js/dist/button.js +++ b/js/dist/button.js @@ -1,3 +1,7 @@ +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-alpha.4): button.js @@ -5,13 +9,7 @@ * -------------------------------------------------------------------------- */ -'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 ($) { /** * ------------------------------------------------------------------------ @@ -51,87 +49,76 @@ var Button = (function ($) { * ------------------------------------------------------------------------ */ - var Button = (function () { + var Button = function () { function Button(element) { _classCallCheck(this, Button); this._element = element; } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Button, [{ - key: 'toggle', + // public - // public + Button.prototype.toggle = function toggle() { + var triggerChangeEvent = true; + var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0]; - value: function toggle() { - var triggerChangeEvent = true; - var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0]; + if (rootElement) { + var input = $(this._element).find(Selector.INPUT)[0]; - if (rootElement) { - var input = $(this._element).find(Selector.INPUT)[0]; + if (input) { + if (input.type === 'radio') { + if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) { + triggerChangeEvent = false; + } else { + var activeElement = $(rootElement).find(Selector.ACTIVE)[0]; - if (input) { - if (input.type === 'radio') { - if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) { - triggerChangeEvent = false; - } else { - var activeElement = $(rootElement).find(Selector.ACTIVE)[0]; - - if (activeElement) { - $(activeElement).removeClass(ClassName.ACTIVE); - } + if (activeElement) { + $(activeElement).removeClass(ClassName.ACTIVE); } } + } - if (triggerChangeEvent) { - input.checked = !$(this._element).hasClass(ClassName.ACTIVE); - $(this._element).trigger('change'); - } - - input.focus(); + if (triggerChangeEvent) { + input.checked = !$(this._element).hasClass(ClassName.ACTIVE); + $(this._element).trigger('change'); } - } else { - this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)); - } - if (triggerChangeEvent) { - $(this._element).toggleClass(ClassName.ACTIVE); + input.focus(); } + } else { + this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)); } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - this._element = null; + + if (triggerChangeEvent) { + $(this._element).toggleClass(ClassName.ACTIVE); } + }; - // static + Button.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + this._element = null; + }; - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); + // static - if (!data) { - data = new Button(this); - $(this).data(DATA_KEY, data); - } + Button._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); - if (config === 'toggle') { - data[config](); - } - }); - } - }, { + if (!data) { + data = new Button(this); + $(this).data(DATA_KEY, data); + } + + if (config === 'toggle') { + data[config](); + } + }); + }; + + _createClass(Button, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -139,7 +126,13 @@ var Button = (function ($) { }]); return Button; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { event.preventDefault(); @@ -170,5 +163,5 @@ var Button = (function ($) { }; return Button; -})(jQuery); +}(jQuery); //# sourceMappingURL=button.js.map |