1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-09 15:16:51 +02:00
This commit is contained in:
Mark Otto
2017-04-16 13:54:07 -07:00
parent 6d64afe508
commit bc0cf36dc8
28 changed files with 100 additions and 173 deletions

6
js/dist/button.js vendored
View File

@@ -62,6 +62,7 @@ var Button = function ($) {
Button.prototype.toggle = function toggle() {
var triggerChangeEvent = true;
var addAriaPressed = true;
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) {
@@ -86,10 +87,13 @@ var Button = function ($) {
}
input.focus();
addAriaPressed = false;
}
}
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
}
if (triggerChangeEvent) {
$(this._element).toggleClass(ClassName.ACTIVE);