mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-11 16:14:04 +02:00
dist
This commit is contained in:
10
js/dist/button.js
vendored
10
js/dist/button.js
vendored
@@ -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) {
|
||||
|
Reference in New Issue
Block a user