Update OOjs UI to v0.1.0-pre (d4cfcce969)
[lhc/web/wiklou.git] / resources / lib / oojs-ui / oojs-ui.js
index 80d4c1d..a7d4fc2 100644 (file)
@@ -1,12 +1,12 @@
 /*!
- * 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 ) {
 
@@ -1463,6 +1463,7 @@ OO.ui.Widget.prototype.updateDisabled = function () {
  * @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
@@ -1844,7 +1845,7 @@ OO.ui.Window.prototype.getTeardownProcess = function () {
  * 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 ) {
@@ -2105,7 +2106,7 @@ OO.ui.Window.prototype.teardown = function ( data ) {
 
        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;
@@ -2118,9 +2119,10 @@ OO.ui.Window.prototype.teardown = function ( data ) {
 /**
  * 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...
  *
@@ -2149,13 +2151,12 @@ OO.ui.Window.prototype.teardown = function ( data ) {
  * 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();
@@ -2879,10 +2880,13 @@ OO.ui.WindowManager.prototype.openWindow = function ( win, data ) {
 
        // 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