]> 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>
Wed, 25 Mar 2015 19:55:16 +0000 (15:55 -0400)
jQuery now returns `null` for empty attributes instead of `undefined`.

Ref gh-1516

ui/dialog.js

index 2f322aa866d80d98a4a3e5cc5044ab56b844b4a3..c7ffbd9efd724afd834a8f6eeb046599092b83fb 100644 (file)
@@ -118,7 +118,9 @@ $.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();
 
@@ -433,10 +435,11 @@ $.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() {