r3604 committed - Button: Update the tooltip when changing the label after init.

r3604 committed - Button: Update the tooltip when changing the label after init.

Revision: 3604
Author: scott.gonzalez
Date: Sun Jan 3 18:19:36 2010
Log: Button: Update the tooltip when changing the label after init.
http://code.google.com/p/jquery-ui/source/detail?r=3604
Modified:
/branches/dev/ui/jquery.ui.button.js
=======================================
--- /branches/dev/ui/jquery.ui.button.js    Sun Jan 3 09:45:42 2010
+++ /branches/dev/ui/jquery.ui.button.js    Sun Jan 3 18:19:36 2010
@@ -29,6 +29,7 @@
    },
    _init: function() {
        this._determineButtonType();
+        this.hasTitle = !!this.buttonElement.attr('title');
        var self = this,
            options = this.options,
@@ -151,6 +152,10 @@
            .removeAttr('aria-pressed')
            .html(this.buttonElement.find(".ui-button-text").html());
+        if (!this.hasTitle) {
+            this.buttonElement.removeAttr('title');
+        }
+
        if (this.type == 'checkbox' || this.type == 'radio') {
            this.element.show();
        }
@@ -186,7 +191,7 @@
                buttonElement
                
    .addClass(multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only")
                    .removeClass("ui-button-text-icons ui-button-text-icon");
-                if (!buttonElement.attr("title")) {
+                if (!this.hasTitle) {
                    buttonElement.attr("title", buttonText);
                }
            }
--