Skip to content

Commit

Permalink
Dialog: Don't use .attr( props, true ) for creating buttons since tha…
Browse files Browse the repository at this point in the history
…t API doesn't exist in jQueery 1.3.2. Fixes #7226 - Dialog buttons badly handled with JQuery 1.3.2.
  • Loading branch information
scottgonzalez committed Apr 7, 2011
1 parent c205fbc commit e388153
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions ui/jquery.ui.dialog.js
Expand Up @@ -37,6 +37,18 @@ var uiDialogClasses =
maxWidth: true, maxWidth: true,
minHeight: true, minHeight: true,
minWidth: true minWidth: true
},
// support for jQuery 1.3.2 - handle common attrFn methods for dialog
attrFn = $.attrFn || {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true,
click: true
}; };


$.widget("ui.dialog", { $.widget("ui.dialog", {
Expand Down Expand Up @@ -376,12 +388,21 @@ $.widget("ui.dialog", {
{ click: props, text: name } : { click: props, text: name } :
props; props;
var button = $('<button type="button"></button>') var button = $('<button type="button"></button>')
.attr( props, true )
.unbind('click')
.click(function() { .click(function() {
props.click.apply(self.element[0], arguments); props.click.apply(self.element[0], arguments);
}) })
.appendTo(uiButtonSet); .appendTo(uiButtonSet);
// can't use .attr( props, true ) with jQuery 1.3.2.
$.each( props, function( key, value ) {
if ( key === "click" ) {
return;
}
if ( key in attrFn ) {
button[ key ]( value );
} else {
button.attr( key, value );
}
});
if ($.fn.button) { if ($.fn.button) {
button.button(); button.button();
} }
Expand Down

0 comments on commit e388153

Please sign in to comment.