Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9043 closed bug (fixed)

Dialog: Buttonpane shown with no buttons when modifying native prototypes

Reported by: mbehm Owned by: mbehm
Priority: minor Milestone: 1.10.1
Component: ui.dialog Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:

Description

jQuery 1.10 dialog by default has buttonpane shown even if no button are defined because the buttons options is only checked for empty object and not empty array.

--- orig/jquery.ui.dialog.js    2013-02-01 09:40:42.781304334 +0200
+++ patch/jquery.ui.dialog.js   2013-02-01 09:41:11.587970771 +0200
@@ -396,7 +396,7 @@
                this.uiDialogButtonPane.remove();
                this.uiButtonSet.empty();
 
-               if ( $.isEmptyObject( buttons ) ) {
+               if ( $.isEmptyObject( buttons ) || ($.isArray(buttons) && buttons.length == 0)) {
                        this.uiDialog.removeClass("ui-dialog-buttons");
                        return;
                }

Change History (8)

comment:1 Changed 7 years ago by Scott González

Owner: set to mbehm
Status: newpending

$.isEmptyObject([]) returns true. Can you please provide a reduced test case showing that this is causing the button pane to be shown?

comment:2 Changed 7 years ago by mbehm

Status: pendingnew

Did some more testing and this bug is caused by frameworks like Prototype that extend Array or Object prototype.

comment:3 Changed 7 years ago by Scott González

Resolution: wontfix
Status: newclosed

comment:4 Changed 7 years ago by Scott González

Resolution: wontfix
Status: closedreopened

Actually, the bug must be coming from Array.prototype modification, not Object.prototype, right? I'm fine with this patch.

comment:5 Changed 7 years ago by Scott González

Milestone: none1.10.1
Status: reopenedopen
Summary: Dialog buttonpane shown with no buttonsDialog: Buttonpane shown with no buttons when modifying native prototypes

comment:6 Changed 7 years ago by mbehm

Actually both of them cause $.isEmptyObject to fail but the default buttons option is array so the patch I provided fixes that.

comment:7 Changed 7 years ago by Scott González

Resolution: fixed
Status: openclosed

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.

Changeset: 7bbda71a32cc4953715ed34eab2ab48c5e736154

comment:8 in reply to:  6 Changed 7 years ago by Scott González

Replying to mbehm:

Actually both of them cause $.isEmptyObject to fail but the default buttons option is array so the patch I provided fixes that.

Right, but we won't support changes to Object.prototype.

Note: See TracTickets for help on using tickets.