r3461 committed - tooltio: proper option-disabled handling, suppressing tooltip complete...

r3461 committed - tooltio: proper option-disabled handling, suppressing tooltip complete...


Revision: 3461
Author: joern.zaefferer
Date: Mon Nov 16 05:56:15 2009
Log: tooltio: proper option-disabled handling, suppressing tooltip
completely for a disabled widget
http://code.google.com/p/jquery-ui/source/detail?r=3461
Modified:
/branches/dev/ui/jquery.ui.tooltip.js
=======================================
--- /branches/dev/ui/jquery.ui.tooltip.js    Sun Nov 15 21:57:57 2009
+++ /branches/dev/ui/jquery.ui.tooltip.js    Mon Nov 16 05:56:15 2009
@@ -49,8 +49,6 @@
    },
    show: function(target) {
-        if (this.options.disabled)
-            return;
        var self = this;
        this.current = target;
        this.currentTitle = target.attr("title");
@@ -67,8 +65,11 @@
        if (!content)
            return;
-
        target.attr("title", "");
+
+        if (this.options.disabled)
+            return;
+
        this.tooltipContent.html(content);
        this.tooltip.position($.extend(this.options.position, {
            of: target
@@ -89,7 +90,13 @@
        if (!this.current)
            return;
-        this.current.removeAttr("aria-describedby");
+        var current = this.current.attr("title", this.currentTitle);
+        this.current = null;
+
+        if (this.options.disabled)
+            return;
+
+        current.removeAttr("aria-describedby");
        this.tooltip.attr("aria-hidden", "true");
        if (this.tooltip.is(':animated'))
@@ -97,8 +104,6 @@
            else
                this.tooltip.stop().fadeOut();
-        this.current.attr("title", this.currentTitle);
-        this.current = null;
    }
});