Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7607 closed bug (notabug)

open and close events pass empty object instead of reference to UI

Reported by: Spiked Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.dialog Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:

Description

Looking thru the code in jquery.ui.dialog.js it would appear that the close and focus events pass the event object but not the UI object. The open event seems to pass neither. In practice (testing), the open and close events definitely receive empty objects in place of the UI object.

Change History (6)

comment:1 Changed 8 years ago by Spiked

Update: Open receives the event object, I guess from the root object. So just missing the reference to the widget/UI.

comment:2 Changed 8 years ago by Scott González

Resolution: invalid
Status: newclosed

This is correct, there's no data to provide for open or close.

comment:3 Changed 8 years ago by Spiked

The documentation shows the UI/Widget object being passed to it. Which would be consistent with all other events of this nature. Why on earth would you not pass a reference to the base dialog?

Practical usage: during creation of the dialog, pass extra options that pertain to your use case. open: function(event, ui) {

if(ui.options.myVar)

a();

else

b();

}

It makes sense, and it's in your documentation. Fix one or the other please.

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

That's not at all consistent with anything. We never pass references to widget instances. All events get a hash of relevant data, sometimes there is no relevant data.

comment:5 Changed 8 years ago by Spiked

http://jqueryui.com/demos/dialog/#event-open

$( ".selector" ).dialog({

open: function(event, ui) { ... }

});

user: "ui is an empty object"

dev?: "that's right!"

user: http://i.imgur.com/yXdWD.png

Thanks for your time, I'll try to remember the cake is a lie, I mean the docs.

comment:6 Changed 8 years ago by Scott González

If you can point to anything in the docs that says otherwise, we will update the docs. So far all you've done is cite something that you apparently made up (passing the widget instance).

Note: See TracTickets for help on using tickets.