From e388153049503255810d4a871e06e9930de74c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 7 Apr 2011 14:06:36 -0400 Subject: [PATCH] Dialog: Don't use .attr( props, true ) for creating buttons since that API doesn't exist in jQueery 1.3.2. Fixes #7226 - Dialog buttons badly handled with JQuery 1.3.2. --- ui/jquery.ui.dialog.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index e88679fc7..56af35d41 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -37,6 +37,18 @@ var uiDialogClasses = maxWidth: true, minHeight: 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", { @@ -376,12 +388,21 @@ $.widget("ui.dialog", { { click: props, text: name } : props; var button = $('') - .attr( props, true ) - .unbind('click') .click(function() { props.click.apply(self.element[0], arguments); }) .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) { button.button(); }