Search and Top Navigation
#7607 closed bug (notabug)
Opened August 04, 2011 07:14PM UTC
Closed August 04, 2011 07:43PM UTC
Last modified August 04, 2011 11:25PM UTC
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.
Attachments (0)
Change History (6)
Changed August 04, 2011 07:22PM UTC by comment:1
Changed August 04, 2011 07:43PM UTC by comment:2
resolution: | → invalid |
---|---|
status: | new → closed |
This is correct, there's no data to provide for open or close.
Changed August 04, 2011 07:48PM UTC by comment:3
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.
Changed August 04, 2011 08:57PM UTC by comment:4
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.
Changed August 04, 2011 09:04PM UTC by comment:5
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.
Changed August 04, 2011 11:25PM UTC by comment:6
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).
Update:
Open receives the event object, I guess from the root object. So just missing the reference to the widget/UI.