]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Don't use .attr( props, true ) for creating buttons since that API doesn...
authorScott González <scott.gonzalez@gmail.com>
Thu, 7 Apr 2011 18:06:36 +0000 (14:06 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 7 Apr 2011 18:06:36 +0000 (14:06 -0400)
ui/jquery.ui.dialog.js

index e88679fc710b1b0f6238f5d4b96b8465d4999de0..56af35d41647553362a7466b713898fb17c0167b 100644 (file)
@@ -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 = $('<button type="button"></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();
                                }