Skip to main content

Search and Top Navigation

#9043 closed bug (fixed)

Opened February 01, 2013 07:46AM UTC

Closed February 01, 2013 02:00PM UTC

Last modified February 01, 2013 02:00PM UTC

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;
                }
Attachments (0)
Change History (8)

Changed February 01, 2013 01:24PM UTC by scottgonzalez comment:1

owner: → 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?

Changed February 01, 2013 01:44PM UTC by mbehm comment:2

status: pendingnew

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

Changed February 01, 2013 01:50PM UTC by scottgonzalez comment:3

resolution: → wontfix
status: newclosed

Changed February 01, 2013 01:52PM UTC by scottgonzalez comment:4

resolution: wontfix
status: closedreopened

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

Changed February 01, 2013 01:53PM UTC by scottgonzalez comment:5

milestone: none1.10.1
status: reopenedopen
summary: Dialog buttonpane shown with no buttonsDialog: Buttonpane shown with no buttons when modifying native prototypes

Changed February 01, 2013 01:56PM UTC by mbehm comment:6

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

Changed February 01, 2013 02:00PM UTC by Scott González comment:7

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

Changed February 01, 2013 02:00PM UTC by scottgonzalez comment:8

Replying to [comment:6 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.