From 866e99b00cb12dcfa0d9b88edf4f4d0ef06ca3f3 Mon Sep 17 00:00:00 2001 From: Kotas Vlastimil Date: Thu, 14 Jan 2016 17:41:36 +0100 Subject: Button toggling - trigger change event on input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bootstrap’s .button styles can be applied to other elements, such as labels, to provide checkbox or radio style button toggling. When the checkbox or radio state is changed, there should be triggered the change event. Currently, the change event is triggered on the Button, which is not correct. Only input fields do support the change event. --- js/src/button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/button.js') diff --git a/js/src/button.js b/js/src/button.js index 3144a3f10..f5551f169 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -90,7 +90,7 @@ const Button = (($) => { if (triggerChangeEvent) { input.checked = !$(this._element).hasClass(ClassName.ACTIVE) - $(this._element).trigger('change') + $(input).trigger('change') } } } else { -- cgit v1.2.3 From 8ff7edaab4f55b6612df3fe670aa9b9ac0984eae Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Wed, 19 Oct 2016 08:27:41 -0700 Subject: version bump to alpha 5 --- js/src/button.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/button.js') diff --git a/js/src/button.js b/js/src/button.js index 24b0cd414..a7eed1826 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): button.js + * Bootstrap (v4.0.0-alpha.5): button.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -15,7 +15,7 @@ const Button = (($) => { */ const NAME = 'button' - const VERSION = '4.0.0-alpha.4' + const VERSION = '4.0.0-alpha.5' const DATA_KEY = 'bs.button' const EVENT_KEY = `.${DATA_KEY}` const DATA_API_KEY = '.data-api' -- cgit v1.2.3 From c2616fb74e6bdc0cd46a5678a2c5cffcbe422106 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Tue, 22 Nov 2016 01:36:00 +1100 Subject: Make JS compliant with the new ESLint rules. --- js/src/button.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/src/button.js') diff --git a/js/src/button.js b/js/src/button.js index a7eed1826..8b9511765 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -66,12 +66,12 @@ const Button = (($) => { toggle() { let triggerChangeEvent = true - let rootElement = $(this._element).closest( + const rootElement = $(this._element).closest( Selector.DATA_TOGGLE )[0] if (rootElement) { - let input = $(this._element).find(Selector.INPUT)[0] + const input = $(this._element).find(Selector.INPUT)[0] if (input) { if (input.type === 'radio') { @@ -80,7 +80,7 @@ const Button = (($) => { triggerChangeEvent = false } else { - let activeElement = $(rootElement).find(Selector.ACTIVE)[0] + const activeElement = $(rootElement).find(Selector.ACTIVE)[0] if (activeElement) { $(activeElement).removeClass(ClassName.ACTIVE) @@ -151,7 +151,7 @@ const Button = (($) => { Button._jQueryInterface.call($(button), 'toggle') }) .on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, (event) => { - let button = $(event.target).closest(Selector.BUTTON)[0] + const button = $(event.target).closest(Selector.BUTTON)[0] $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)) }) -- cgit v1.2.3