1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-11 16:14:04 +02:00
This commit is contained in:
Mark Otto
2018-06-21 22:55:23 -07:00
parent e59265c42d
commit eadeab9d1c
36 changed files with 349 additions and 242 deletions

10
js/dist/button.js vendored
View File

@@ -60,14 +60,14 @@ var Button = function ($) {
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) {
var input = $(this._element).find(Selector.INPUT)[0];
var input = this._element.querySelector(Selector.INPUT);
if (input) {
if (input.type === 'radio') {
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
triggerChangeEvent = false;
} else {
var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
var activeElement = rootElement.querySelector(Selector.ACTIVE);
if (activeElement) {
$(activeElement).removeClass(ClassName.ACTIVE);
@@ -80,7 +80,7 @@ var Button = function ($) {
return;
}
input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
input.checked = !this._element.classList.contains(ClassName.ACTIVE);
$(input).trigger('change');
}
@@ -90,7 +90,7 @@ var Button = function ($) {
}
if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
}
if (triggerChangeEvent) {