r3589 committed - Button: Added aria-pressed attribute for checkbox and radio buttons.

r3589 committed - Button: Added aria-pressed attribute for checkbox and radio buttons.

Revision: 3589
Author: scott.gonzalez
Date: Sat Jan 2 08:29:19 2010
Log: Button: Added aria-pressed attribute for checkbox and radio buttons.
http://code.google.com/p/jquery-ui/source/detail?r=3589
Modified:
/branches/dev/ui/jquery.ui.button.js
=======================================
--- /branches/dev/ui/jquery.ui.button.js    Sat Jan 2 08:18:52 2010
+++ /branches/dev/ui/jquery.ui.button.js    Sat Jan 2 08:29:19 2010
@@ -60,8 +60,9 @@
                    if (options.disabled) { return; }
                    $(this).toggleClass("ui-state-active");
                    self.element
-                        .attr("checked", !this.checked)
+                        .attr("checked", !self.element[0].checked)
                        .click();
+                    self.buttonElement.attr('aria-pressed', self.element[0].checked);
                });
            break;
            case 'radio':
@@ -71,6 +72,7 @@
                    self.element
                        .attr("checked", true)
                        .click();
+                    self.buttonElement.attr('aria-pressed', true);
                    var radio = self.element[0],
                        name = radio.name,
@@ -90,7 +92,8 @@
                            .map(function() {
                                return $(this).button('widget')[0];
                            })
-                            .removeClass('ui-state-active');
+                            .removeClass('ui-state-active')
+                            .attr('aria-pressed', false);
                    }
                });
            break;
@@ -127,9 +130,11 @@
            this.buttonElement = $("[for=" + this.element.attr("id") + "]");
            this.element.hide();
-            if (this.element.is(':checked')) {
+            var checked = this.element.is(':checked');
+            if (checked) {
                this.buttonElement.addClass('ui-state-active');
            }
+            this.buttonElement.attr('aria-pressed', checked)
        } else {
            this.buttonElement = this.element;
        }
--