diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-11-05 09:37:01 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-11-08 17:53:35 -0500 |
commit | ccb741bd0ca4f2309f4cef7e6d05ff72ff37a342 (patch) | |
tree | 7047822e393a1e08dd3e715558591876c74c7ebf | |
parent | 8f0daea9eb0b5e6feb31b1e69878919bce78cef1 (diff) | |
download | jquery-ui-ccb741bd0ca4f2309f4cef7e6d05ff72ff37a342.tar.gz jquery-ui-ccb741bd0ca4f2309f4cef7e6d05ff72ff37a342.zip |
Dialog: Don't use .attr( props, true ).
(cherry picked from commit a8de99c791ae24e558920e1756fb7d0bf9dfc166)
-rw-r--r-- | ui/jquery.ui.dialog.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index c1ac7bc9e..a031eb5e0 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -369,15 +369,18 @@ $.widget("ui.dialog", { } if ( hasButtons ) { $.each( buttons, function( name, props ) { + var button, click; props = $.isFunction( props ) ? { click: props, text: name } : props; - var button = $( "<button type='button'></button>" ) - .attr( props, true ) - .unbind( "click" ) - .click(function() { - props.click.apply( that.element[0], arguments ); - }) + // Default to a non-submitting button + props = $.extend( { type: "button" }, props ); + // Change the context for the click callback to be the main element + click = props.click; + props.click = function() { + click.apply( that.element[0], arguments ); + }; + button = $( "<button></button>", props ) .appendTo( that.uiButtonSet ); if ( $.fn.button ) { button.button(); |