Skip to content

Instantly share code, notes, and snippets.

@jzaefferer
Created November 18, 2012 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzaefferer/f945add6e6d32935d906 to your computer and use it in GitHub Desktop.
Save jzaefferer/f945add6e6d32935d906 to your computer and use it in GitHub Desktop.
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index b998c25..271d64e 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -347,14 +347,21 @@ $.widget("ui.dialog", {
uiDialogTitle = $( "<span>" )
.uniqueId()
.addClass( "ui-dialog-title" )
- .html( this.options.title || "&#160;" )
.prependTo( this.uiDialogTitlebar );
+ this._title( uiDialogTitle );
this.uiDialog.attr({
"aria-labelledby": uiDialogTitle.attr( "id" )
});
},
+ _title: function( title ) {
+ if ( !this.options.title ) {
+ title.html( "&#160;" );
+ }
+ title.text( this.options.title );
+ },
+
_createButtonPane: function() {
var uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
@@ -612,9 +619,7 @@ $.widget("ui.dialog", {
}
if ( key === "title" ) {
- // convert whatever was passed in to a string, for html() to not throw up
- $( ".ui-dialog-title", this.uiDialogTitlebar )
- .html( "" + ( value || "&#160;" ) );
+ this._title( $( ".ui-dialog-title", this.uiDialogTitlebar ) );
}
},
@mikesherov
Copy link

On Line 35... where did value go? Looks like this._title needs two params, title and titleText. Am I wrong?

@jzaefferer
Copy link
Author

_setOption used to pass along its value argument. That's not necessary any more, as the option is updated before calling _title. Leftover from previous refactorings.

@scottgonzalez
Copy link

On line 35, use .find() instead of passing a context. Otherwise, this looks good.

@gengyi02
Copy link

gengyi02 commented Sep 1, 2014

hi, i found this page by http://stackoverflow.com/questions/21830980/vulnerable-javascript-library-jquery-ui-1-8-16-custom-min-js. I have a similar problem with jquery-ui-1.8.14.js when i was using Acunetix scan. I will be grateful if you can help me out here, maybe a patch file? thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment