mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Dialog: Check for empty array in addition to empty object when checking if there are buttons. Fixes #9043 - Dialog: Buttonpane shown with no buttons when modifying native prototypes.
This commit is contained in:
parent
62cda1f95d
commit
7bbda71a32
@ -16,6 +16,7 @@
|
|||||||
<link rel="stylesheet" href="../demos.css">
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
|
Array.prototype.test = $.noop;
|
||||||
$( "#dialog" ).dialog();
|
$( "#dialog" ).dialog();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -174,6 +174,16 @@ test("buttons - advanced", function() {
|
|||||||
element.remove();
|
element.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("#9043: buttons with Array.prototype modification", function() {
|
||||||
|
expect( 1 );
|
||||||
|
Array.prototype.test = $.noop;
|
||||||
|
var element = $( "<div></div>" ).dialog();
|
||||||
|
equal( element.dialog( "widget" ).find( ".ui-dialog-buttonpane" ).length, 0,
|
||||||
|
"no button pane" );
|
||||||
|
element.remove();
|
||||||
|
delete Array.prototype.test;
|
||||||
|
});
|
||||||
|
|
||||||
test("closeOnEscape", function() {
|
test("closeOnEscape", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
var element = $("<div></div>").dialog({ closeOnEscape: false });
|
var element = $("<div></div>").dialog({ closeOnEscape: false });
|
||||||
|
2
ui/jquery.ui.dialog.js
vendored
2
ui/jquery.ui.dialog.js
vendored
@ -396,7 +396,7 @@ $.widget( "ui.dialog", {
|
|||||||
this.uiDialogButtonPane.remove();
|
this.uiDialogButtonPane.remove();
|
||||||
this.uiButtonSet.empty();
|
this.uiButtonSet.empty();
|
||||||
|
|
||||||
if ( $.isEmptyObject( buttons ) ) {
|
if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
|
||||||
this.uiDialog.removeClass("ui-dialog-buttons");
|
this.uiDialog.removeClass("ui-dialog-buttons");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user