[whatwg] Comments on <dialog>
scott.gonzalez at gmail.com
Tue Dec 17 03:13:15 PST 2013
jQuery UI uses open(), close().
On Tue, Dec 17, 2013 at 1:15 AM, Matt Falkenhagen <falken at chromium.org>wrote:
> On Fri, Sep 27, 2013 at 7:15 AM, Ian Hickson <ian at hixie.ch> wrote:
> > On Mon, 26 Aug 2013, Ojan Vafai wrote:
> > >
> > > IMO, showModalDialog is the legacy broken API we're stuck with. Better
> > > to name the new thing in a way that's self-consistent and consistent
> > > with everything else (i.e. openModal).
> > I started doing this, since several people have asked about this and it
> > seems the consistency between showModalDialog()/close() seems less
> > interesting to people than the consistency with "open" everywhere else.
> > However, it turns out this would make the show() method clash with the
> > "open" IDL attribute on <dialog>, which we want since it matches the name
> > of the open="" content attribute which matches <details open>.
> > Note that window.open() and document.open() don't really do the same as
> > this method does, either. window.open() creates a new Window, or
> > and existing one; document.open() resets the document. dialog.show() just
> > changes the dialog to be visible.
> > Also, there's an interesting mix in other APIs. (Disclaimer: I don't know
> > many of these APIs personally, so I may be misinterpreting their
> > documentation wildly. I basically looked for terms like "open" and
> > in the docs and tried to see what the right methods were in each case. I
> > only included methods for modal dialogs if there was a trivial method;
> > many APIs have to be configured to make dialogs modals separately.)
> > Android uses show() and dismiss()
> > Closure uses setVisible()
> > Cocoa uses makeKeyAndOrderFront:, orderOut:, close, and performClose:.
> > Delphi uses Show(), ShowModal(), Hide(), and Close().
> > Ext JS uses show(), hide(), and close().
> > jQuery uses "open" and "close".
> > Gtk uses gtk_widget_show(), gtk_dialog_run(), gtk_window_close().
> Gtk also has gtk_widget_hide(), see 
> > .NET uses Show(), ShowDialog(), Hide(), and Close().
> > Win32 uses ShowWindow() and CloseWindow().
> > X11 uses XMapWindow() and XUnmapWindow()
> > Most of the APIs I looked at use "close". Most use "show". So I think
> > we're in ok company here.
> Sorry to add feedback so late. Whenever there's a post/tweet about
> Chrome's <dialog>, the most common complaint from devs seems to be this
> show/close naming.
> I think with any naming choice there will be an inconsistency somewhere
> in the whole platform API. For example, show/hide is a little weird since
> dialog.hide() is different from dialog.hidden = true. But show/close are
> immediately inconsistent with themselves which gives people an adverse
> I think I'd prefer, in order:
> 1) open()/openModal()/close() and "opened" attribute
> 2) show()/showModal()/hide() and "open"
> 3) show()/showModal()/close() and "open"
> 1) is nice because it's internally consistent. The downside is that
> dialog.opened is inconsistent with details.open.
> In the list of existing APIs above, only Win32 has only show/close. Of APIs
> that have all of show/hide/close, it looks like close does something like
> dispose of the object/free its memory so it can't be shown again (e.g., see
> ) So show/hide for <dialog> seems more consistent than
> show/close with these APIs.
> Some additional data points:
> - QT uses show(), hide(), close(), done() (close/done delete the dialog)
> - Dojo uses show(), hide() 
> - Java AWT uses setVisible() (show() and hide() are deprecated, also
> there is a dispose()) 
> - Blackberry uses show(), close() 
> - Xt uses XtPopup(), XtPopdown() 
> - wxWindows uses Show(bool), ShowModal(), EndModal(), Close() 
> - YUI uses show(), hide() 
> - Bootstrap uses show(), hide() 
> - GWT uses show(), hide() 
> It seems existing JS frameworks mostly use show/hide, maybe because they
> predate element.hidden.
>  https://developer.gnome.org/gtk3/stable/GtkWidget.html
>  http://qt-project.org/doc/qt-4.8/qwidget.html#close
>  http://dojotoolkit.org/api/?qs=1.9/dijit/Dialog
>  http://docs.oracle.com/javase/6/docs/api/java/awt/Dialog.html
>  http://www.unix.com/man-page/all/3x/XtPopup/
>  http://docs.wxwidgets.org/stable/classwx_dialog.html
>  http://yuilibrary.com/yui/docs/api/classes/Panel.html
More information about the whatwg