Update OOjs UI to v0.6.2
[lhc/web/wiklou.git] / resources / lib / oojs-ui / oojs-ui.js
index 5f75895..38aa092 100644 (file)
@@ -1,12 +1,12 @@
 /*!
- * OOjs UI v0.6.0
+ * OOjs UI v0.6.2
  * https://www.mediawiki.org/wiki/OOjs_UI
  *
- * Copyright 2011–2014 OOjs Team and other contributors.
+ * Copyright 2011–2015 OOjs Team and other contributors.
  * Released under the MIT license
  * http://oojs.mit-license.org
  *
- * Date: 2014-12-16T21:00:55Z
+ * Date: 2015-01-10T01:25:19Z
  */
 ( function ( OO ) {
 
@@ -171,7 +171,8 @@ OO.ui.contains = function ( containers, contained, matchContainers ) {
         * @return {string} Translated message with parameters substituted
         */
        OO.ui.msg = function ( key ) {
-               var message = messages[key], params = Array.prototype.slice.call( arguments, 1 );
+               var message = messages[key],
+                       params = Array.prototype.slice.call( arguments, 1 );
                if ( typeof message === 'string' ) {
                        // Perform $1 substitution
                        message = message.replace( /\$(\d+)/g, function ( unused, n ) {
@@ -721,6 +722,7 @@ OO.ui.ActionSet.prototype.organize = function () {
  * @param {Object} [config] Configuration options
  * @cfg {Function} [$] jQuery for the frame the widget is in
  * @cfg {string[]} [classes] CSS class names to add
+ * @cfg {string} [id] HTML id attribute
  * @cfg {string} [text] Text to insert
  * @cfg {jQuery} [$content] Content elements to append (after text)
  * @cfg {Mixed} [data] Element data
@@ -741,6 +743,9 @@ OO.ui.Element = function OoUiElement( config ) {
        if ( $.isArray( config.classes ) ) {
                this.$element.addClass( config.classes.join( ' ' ) );
        }
+       if ( config.id ) {
+               this.$element.attr( 'id', config.id );
+       }
        if ( config.text ) {
                this.$element.text( config.text );
        }
@@ -947,10 +952,10 @@ OO.ui.Element.static.getBorders = function ( el ) {
                right = parseFloat( style ? style.borderRightWidth : $el.css( 'borderRightWidth' ) ) || 0;
 
        return {
-               top: Math.round( top ),
-               left: Math.round( left ),
-               bottom: Math.round( bottom ),
-               right: Math.round( right )
+               top: top,
+               left: left,
+               bottom: bottom,
+               right: right
        };
 };
 
@@ -1770,7 +1775,8 @@ OO.ui.Window.prototype.getContentHeight = function () {
        // Temporarily resize the frame so getBodyHeight() can use scrollHeight measurements.
        // Disable transitions first, otherwise we'll get values from when the window was animating.
        this.withoutSizeTransitions( function () {
-               var oldHeight = frameStyleObj.height, oldPosition = bodyStyleObj.position;
+               var oldHeight = frameStyleObj.height,
+                       oldPosition = bodyStyleObj.position;
                frameStyleObj.height = '1px';
                // Force body to resize to new width
                bodyStyleObj.position = 'relative';
@@ -1779,7 +1785,7 @@ OO.ui.Window.prototype.getContentHeight = function () {
                bodyStyleObj.position = oldPosition;
        } );
 
-       return Math.round(
+       return (
                // Add buffer for border
                ( this.$frame.outerHeight() - this.$frame.innerHeight() ) +
                // Use combined heights of children
@@ -3090,7 +3096,7 @@ OO.ui.WindowManager.prototype.addWindows = function ( windows ) {
  *
  * Windows will be closed before they are removed.
  *
- * @param {string} name Symbolic name of window to remove
+ * @param {string[]} names Symbolic names of windows to remove
  * @return {jQuery.Promise} Promise resolved when window is closed and removed
  * @throws {Error} If windows being removed are not being managed
  */
@@ -3236,17 +3242,15 @@ OO.ui.WindowManager.prototype.toggleAriaIsolation = function ( isolate ) {
 
 /**
  * Destroy window manager.
- *
- * Windows will not be closed, only removed from the DOM.
  */
 OO.ui.WindowManager.prototype.destroy = function () {
        this.toggleGlobalEvents( false );
        this.toggleAriaIsolation( false );
+       this.clearWindows();
        this.$element.remove();
 };
 
 /**
- * @abstract
  * @class
  *
  * @constructor
@@ -4759,7 +4763,7 @@ OO.ui.IndicatorElement.prototype.setIndicatorElement = function ( $indicator ) {
                .addClass( 'oo-ui-indicatorElement-indicator' )
                .toggleClass( 'oo-ui-indicator-' + this.indicator, !!this.indicator );
        if ( this.indicatorTitle !== null ) {
-               this.$indicatorTitle.attr( 'title', this.indicatorTitle );
+               this.$indicator.attr( 'title', this.indicatorTitle );
        }
 };
 
@@ -6439,7 +6443,7 @@ OO.ui.MessageDialog.prototype.getBodyHeight = function () {
        $scrollable.height();
        $scrollable.contents().show();
 
-       bodyHeight = Math.round( this.text.$element.outerHeight( true ) );
+       bodyHeight = this.text.$element.outerHeight( true );
        $scrollable[0].style.overflow = oldOverflow;
 
        return bodyHeight;
@@ -10120,6 +10124,8 @@ OO.ui.RadioInputWidget.prototype.isSelected = function () {
  * @param {Object} [config] Configuration options
  * @cfg {string} [type='text'] HTML tag `type` attribute
  * @cfg {string} [placeholder] Placeholder text
+ * @cfg {boolean} [autofocus=false] Ask the browser to focus this widget, using the 'autofocus' HTML
+ *  attribute
  * @cfg {boolean} [readOnly=false] Prevent changes
  * @cfg {boolean} [multiline=false] Allow multiple lines of text
  * @cfg {boolean} [autosize=false] Automatically resize to fit content
@@ -10173,6 +10179,9 @@ OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) {
        if ( config.placeholder ) {
                this.$input.attr( 'placeholder', config.placeholder );
        }
+       if ( config.autofocus ) {
+               this.$input.attr( 'autofocus', 'autofocus' );
+       }
        this.$element.attr( 'role', 'textbox' );
 };
 
@@ -11361,8 +11370,8 @@ OO.ui.PopupWidget.prototype.updateDimensions = function ( transition ) {
        popupOffset = this.width * ( { left: 0, center: -0.5, right: -1 } )[this.align];
 
        // Figure out if this will cause the popup to go beyond the edge of the container
-       originOffset = Math.round( this.$element.offset().left );
-       containerLeft = Math.round( this.$container.offset().left );
+       originOffset = this.$element.offset().left;
+       containerLeft = this.$container.offset().left;
        containerWidth = this.$container.innerWidth();
        containerRight = containerLeft + containerWidth;
        popupLeft = popupOffset - this.containerPadding;
@@ -11436,7 +11445,7 @@ OO.ui.ProgressBarWidget = function OoUiProgressBarWidget( config ) {
 
        // Initialization
        this.setProgress( config.progress !== undefined ? config.progress : false );
-       this.$bar.addClass( 'oo-ui-progressBarWidget-bar');
+       this.$bar.addClass( 'oo-ui-progressBarWidget-bar' );
        this.$element
                .attr( {
                        role: 'progressbar',