/*!
- * OOjs UI v0.1.0-pre (20c61ec865)
+ * OOjs UI v0.1.0-pre (d4cfcce969)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-11-20T18:41:26Z
+ * Date: 2014-11-21T00:12:34Z
*/
( function ( OO ) {
* @param {Object} [config] Configuration options
* @cfg {string} [size] Symbolic name of dialog size, `small`, `medium`, `large` or `full`; omit to
* use #static-size
+ * @fires initialize
*/
OO.ui.Window = function OoUiWindow( config ) {
// Configuration initialization
* instead of display.
*
* @param {boolean} [show] Make window visible, omit to toggle visibility
- * @fires toggle
+ * @fires visible
* @chainable
*/
OO.ui.Window.prototype.toggle = function ( show ) {
this.getTeardownProcess( data ).execute().done( function () {
// Force redraw by asking the browser to measure the elements' widths
- win.$element.removeClass( 'oo-ui-window-load oo-ui-window-setup' ).width();
+ win.$element.removeClass( 'oo-ui-window-setup' ).width();
win.$content.removeClass( 'oo-ui-window-content-setup' ).width();
win.$element.hide();
win.visible = false;
/**
* Load the frame contents.
*
- * Once the iframe's stylesheets are loaded the returned promise will be resolved. Calling while
- * loading will return a promise but not trigger a new loading cycle. Calling after loading is
- * complete will return a promise that's already been resolved.
+ * Once the iframe's stylesheets are loaded, the `load` event will be emitted and the returned
+ * promise will be resolved. Calling while loading will return a promise but not trigger a new
+ * loading cycle. Calling after loading is complete will return a promise that's already been
+ * resolved.
*
* Sounds simple right? Read on...
*
* All this stylesheet injection and polling magic is in #transplantStyles.
*
* @return {jQuery.Promise} Promise resolved when loading is complete
+ * @fires load
*/
OO.ui.Window.prototype.load = function () {
var sub, doc, loading,
win = this;
- this.$element.addClass( 'oo-ui-window-load' );
-
// Non-isolated windows are already "loaded"
if ( !this.loading && !this.isolated ) {
this.loading = $.Deferred().resolve();
// Window opening
if ( opening.state() !== 'rejected' ) {
- if ( !win.getManager() ) {
+ // Begin loading the window if it's not loading or loaded already - may take noticable time
+ // and we want to do this in parallel with any other preparatory actions
+ if ( !win.isLoading() && !win.isLoaded() ) {
+ // Finish initializing the window (must be done after manager is attached to DOM)
win.setManager( this );
+ preparing.push( win.load() );
}
- preparing.push( win.load() );
if ( this.closing ) {
// If a window is currently closing, wait for it to complete