r1075 - trunk/ui

r1075 - trunk/ui

Author: rdworth
Date: Tue Dec 9 21:10:37 2008
New Revision: 1075
Modified:
trunk/ui/ui.core.js
Log:
core widget: added ui-state-disabled and aria-disabled to widget plugin's
disable/enable/destroy
Modified: trunk/ui/ui.core.js
==============================================================================
--- trunk/ui/ui.core.js    (original)
+++ trunk/ui/ui.core.js    Tue Dec 9 21:10:37 2008
@@ -1,4 +1,4 @@
-/*
+/*
* jQuery UI @VERSION
*
* Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
@@ -301,6 +301,7 @@
    $[namespace][name] = function(element, options) {
        var self = this;
+        this.namespace = namespace;
        this.widgetName = name;
        this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
        this.widgetBaseClass = namespace + '-' + name;
@@ -336,7 +337,9 @@
$.widget.prototype = {
    _init: function() {},
    destroy: function() {
-        this.element.removeData(this.widgetName);
+        this.element.removeData(this.widgetName)
+            .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace
+ '-state-disabled')
+            .removeAttr('aria-disabled');
    },
    option: function(key, value) {
@@ -363,7 +366,8 @@
        if (key == 'disabled') {
            this.element[value ? 'addClass' : 'removeClass'](
-                this.widgetBaseClass + '-disabled');
+                this.widgetBaseClass + '-disabled' + ' ' + this.namespace
+ '-state-disabled')
+                .attr("aria-disabled", value);
        }
    },