Dialog api

Dialog api

1. what is the return value of .dialog()?

    e.g $(div).dialog({..}) will return $(div) or the dialog widget?

   I cannot find it in the documentation?

2. I have googled for information about dialog cleanup

stackoverflow

   But the information in the page  may be outdated, will dialog detach its event handlers (close, open...) when destroy?

  Do i need to call $(div).off() or $(div).dialog().off() or something else?