Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/bootstrap/button.js')
-rw-r--r--assets/javascripts/bootstrap/button.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/assets/javascripts/bootstrap/button.js b/assets/javascripts/bootstrap/button.js
index 03f787e..cd82242 100644
--- a/assets/javascripts/bootstrap/button.js
+++ b/assets/javascripts/bootstrap/button.js
@@ -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) {
@@ -81,15 +82,21 @@ var Button = function ($) {
}
if (triggerChangeEvent) {
+ if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
+ return;
+ }
input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
$(input).trigger('change');
}
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);
@@ -164,3 +171,4 @@ var Button = function ($) {
return Button;
}(jQuery);
+//# sourceMappingURL=button.js.map \ No newline at end of file