]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Properly handle empty title with jQuery git
authorScott González <scott.gonzalez@gmail.com>
Mon, 23 Mar 2015 22:37:47 +0000 (18:37 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 9 Jun 2016 17:17:02 +0000 (13:17 -0400)
jQuery now returns `null` for empty attributes instead of `undefined`.

Ref gh-1516

(cherry picked from commit fdbb85be397b1d1e632ead53a53c57d30739e70c)

ui/dialog.js

index c48d76db3aa0966987de981da910672bd6ec319c..fc9e3fcea9bbac4c3a433edfc5d39705208e140a 100644 (file)
@@ -107,7 +107,9 @@ return $.widget( "ui.dialog", {
                        index: this.element.parent().children().index( this.element )
                };
                this.originalTitle = this.element.attr( "title" );
-               this.options.title = this.options.title || this.originalTitle;
+               if ( this.options.title == null && this.originalTitle != null ) {
+                       this.options.title = this.originalTitle;
+               }
 
                this._createWrapper();
 
@@ -422,10 +424,11 @@ return $.widget( "ui.dialog", {
        },
 
        _title: function( title ) {
-               if ( !this.options.title ) {
+               if ( this.options.title ) {
+                       title.text( this.options.title );
+               } else {
                        title.html( "&#160;" );
                }
-               title.text( this.options.title );
        },
 
        _createButtonPane: function() {