© 12 May, 2013, Martin Rinehart
Window is a
Rect that implements the
Closable capability (with a window-closing ("X") button in the right-top corner).
With CSS3 border radii capabilities, a
Window need not be rectangular. Circles and ovals are possible. We're partial to windows shaped like shields.
The arguments to the
Window constructor are the same as the arguments to the
Rect constructor. See the
DEFAULTS.Window data to customize the window.
Internally, the constructor prepares the arguments for
Rect.init method and the
The default action on a closing button click is to call the
window.onclose() method before deleting or closing anything. If the container's
false the closing button's click handler immediately exits. If the
onclose() doesn't exist, or if it exists and returns anything other than
false the click handler recursively deletes all DOM elements.
If your window is, for example, a dialog box that you will want available for later use, its
onclose() might just set
display: 'none' and
Rect (and, by inheritance,
Our favorite mistake is to use the name
window for a reference to a
Window instance. This, of course, causes havoc since
window is the name of the global object. (More precisely, it is the name of one global object, since you have one global per frame, each of them named
Feedback: MartinRinehart at gmail dot com
# # #