X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=resources%2Flib%2Fooui%2Foojs-ui-core.js;h=72b1e050f2480ab6eb27e33068a28b52df176a20;hb=9f4fa9d8dbc85d11a0fc66f02cd4b87105746865;hp=64596751f8392b26cb427bf13c5ec5ca8736c923;hpb=ce56ffaa134801174bd561dd0bb3c667c88d4e6e;p=lhc%2Fweb%2Fwiklou.git
diff --git a/resources/lib/ooui/oojs-ui-core.js b/resources/lib/ooui/oojs-ui-core.js
index 64596751f8..72b1e050f2 100644
--- a/resources/lib/ooui/oojs-ui-core.js
+++ b/resources/lib/ooui/oojs-ui-core.js
@@ -1,12 +1,12 @@
/*!
- * OOUI v0.29.6
+ * OOUI v0.30.3
* https://www.mediawiki.org/wiki/OOUI
*
- * Copyright 2011â2018 OOUI Team and other contributors.
+ * Copyright 2011â2019 OOUI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2018-12-05T00:15:55Z
+ * Date: 2019-02-21T10:57:07Z
*/
( function ( OO ) {
@@ -377,6 +377,8 @@ OO.ui.infuse = function ( idOrNode, config ) {
'ooui-dialog-process-retry': 'Try again',
// Label for process dialog retry action button, visible when describing only warnings
'ooui-dialog-process-continue': 'Continue',
+ // Label for button in combobox input that triggers its dropdown
+ 'ooui-combobox-button-label': 'Dropdown for combobox',
// Label for the file selection widget's select file button
'ooui-selectfile-button-select': 'Select a file',
// Label for the file selection widget if file selection is not supported
@@ -424,7 +426,7 @@ OO.ui.infuse = function ( idOrNode, config ) {
* label: OO.ui.msg( 'ooui-dialog-message-accept' ),
* icon: 'check'
* } );
- * $( 'body' ).append( button.$element );
+ * $( document.body ).append( button.$element );
*
* // A button displaying "OK" in Urdu
* $.i18n().locale = 'ur';
@@ -432,7 +434,7 @@ OO.ui.infuse = function ( idOrNode, config ) {
* label: OO.ui.msg( 'ooui-dialog-message-accept' ),
* icon: 'check'
* } );
- * $( 'body' ).append( button.$element );
+ * $( document.body ).append( button.$element );
* } );
*
* @param {string} key Message key
@@ -568,7 +570,7 @@ OO.ui.getViewportSpacing = function () {
OO.ui.getDefaultOverlay = function () {
if ( !OO.ui.$defaultOverlay ) {
OO.ui.$defaultOverlay = $( '
' ).addClass( 'oo-ui-defaultOverlay' );
- $( 'body' ).append( OO.ui.$defaultOverlay );
+ $( document.body ).append( OO.ui.$defaultOverlay );
}
return OO.ui.$defaultOverlay;
};
@@ -622,7 +624,10 @@ OO.ui.Element = function OoUiElement( config ) {
config = config || {};
// Properties
- this.$ = $;
+ this.$ = function () {
+ OO.ui.warnDeprecation( 'this.$ is deprecated, use global $ instead' );
+ return $.apply( this, arguments );
+ };
this.elementId = null;
this.visible = true;
this.data = config.data;
@@ -697,6 +702,13 @@ OO.ui.Element.static.tagName = 'div';
*/
OO.ui.Element.static.infuse = function ( idOrNode, config ) {
var obj = OO.ui.Element.static.unsafeInfuse( idOrNode, config, false );
+
+ if ( typeof idOrNode === 'string' ) {
+ // IDs deprecated since 0.29.7
+ OO.ui.warnDeprecation(
+ 'Passing a string ID to infuse is deprecated. Use an HTMLElement or jQuery collection instead.'
+ );
+ }
// Verify that the type matches up.
// FIXME: uncomment after T89721 is fixed, see T90929.
/*
@@ -1139,7 +1151,10 @@ OO.ui.Element.static.getScrollLeft = ( function () {
var rtlScrollType = null;
function test() {
- var $definer = $( '
A
' ),
+ var $definer = $( '
' ).attr( {
+ dir: 'rtl',
+ style: 'font-size: 14px; width: 4px; height: 1px; position: absolute; top: -1000px; overflow: scroll;'
+ } ).text( 'ABCD' ),
definer = $definer[ 0 ];
$definer.appendTo( 'body' );
@@ -1327,6 +1342,7 @@ OO.ui.Element.static.scrollIntoView = function ( el, config ) {
}
}
if ( !$.isEmptyObject( animations ) ) {
+ // eslint-disable-next-line jquery/no-animate
$container.stop( true ).animate( animations, config.duration === undefined ? 'fast' : config.duration );
$container.queue( function ( next ) {
deferred.resolve();
@@ -1891,28 +1907,28 @@ OO.ui.Theme.prototype.getDialogTransitionDuration = function () {
/**
* The TabIndexedElement class is an attribute mixin used to add additional functionality to an
* element created by another class. The mixin provides a âtabIndexâ property, which specifies the
- * order in which users will navigate through the focusable elements via the "tab" key.
+ * order in which users will navigate through the focusable elements via the âtabâ key.
*
* @example
* // TabIndexedElement is mixed into the ButtonWidget class
* // to provide a tabIndex property.
* var button1 = new OO.ui.ButtonWidget( {
- * label: 'fourth',
- * tabIndex: 4
- * } );
- * var button2 = new OO.ui.ButtonWidget( {
- * label: 'second',
- * tabIndex: 2
- * } );
- * var button3 = new OO.ui.ButtonWidget( {
- * label: 'third',
- * tabIndex: 3
- * } );
- * var button4 = new OO.ui.ButtonWidget( {
- * label: 'first',
- * tabIndex: 1
- * } );
- * $( 'body' ).append( button1.$element, button2.$element, button3.$element, button4.$element );
+ * label: 'fourth',
+ * tabIndex: 4
+ * } ),
+ * button2 = new OO.ui.ButtonWidget( {
+ * label: 'second',
+ * tabIndex: 2
+ * } ),
+ * button3 = new OO.ui.ButtonWidget( {
+ * label: 'third',
+ * tabIndex: 3
+ * } ),
+ * button4 = new OO.ui.ButtonWidget( {
+ * label: 'first',
+ * tabIndex: 1
+ * } );
+ * $( document.body ).append( button1.$element, button2.$element, button3.$element, button4.$element );
*
* @abstract
* @class
@@ -2089,7 +2105,7 @@ OO.ui.mixin.TabIndexedElement.prototype.isLabelableNode = function ( $node ) {
*/
OO.ui.mixin.TabIndexedElement.prototype.focus = function () {
if ( !this.isDisabled() ) {
- this.$tabIndexed.focus();
+ this.$tabIndexed.trigger( 'focus' );
}
return this;
};
@@ -2101,7 +2117,7 @@ OO.ui.mixin.TabIndexedElement.prototype.focus = function () {
* @return {OO.ui.Element} The element, for chaining
*/
OO.ui.mixin.TabIndexedElement.prototype.blur = function () {
- this.$tabIndexed.blur();
+ this.$tabIndexed.trigger( 'blur' );
return this;
};
@@ -2114,7 +2130,7 @@ OO.ui.mixin.TabIndexedElement.prototype.simulateLabelClick = function () {
/**
* ButtonElement is often mixed into other classes to generate a button, which is a clickable
- * interface element that can be configured with access keys for accessibility.
+ * interface element that can be configured with access keys for keyboard interaction.
* See the [OOUI documentation on MediaWiki] [1] for examples.
*
* [1]: https://www.mediawiki.org/wiki/OOUI/Widgets/Buttons_and_Switches#Buttons
@@ -2509,6 +2525,11 @@ OO.ui.mixin.GroupElement.prototype.findItemsFromData = function ( data ) {
* @return {OO.ui.Element} The element, for chaining
*/
OO.ui.mixin.GroupElement.prototype.addItems = function ( items, index ) {
+
+ if ( items.length === 0 ) {
+ return this;
+ }
+
// Mixin method
OO.EmitterList.prototype.addItems.call( this, items, index );
@@ -2572,6 +2593,10 @@ OO.ui.mixin.GroupElement.prototype.insertItemElements = function ( itemWidget, i
OO.ui.mixin.GroupElement.prototype.removeItems = function ( items ) {
var i, len, item, index;
+ if ( items.length === 0 ) {
+ return this;
+ }
+
// Remove specific items elements
for ( i = 0, len = items.length; i < len; i++ ) {
item = items[ i ];
@@ -2853,7 +2878,7 @@ OO.ui.mixin.LabelElement.prototype.setLabelContent = function ( label ) {
* value using a jQuery selection. For example:
*
* // Use a
tag instead of a
- * $icon: $("
")
+ * $icon: $( '
' )
* // Use an existing icon element instead of the one generated by the class
* $icon: this.$element
* // Use an icon element from a child widget
@@ -2880,6 +2905,11 @@ OO.ui.mixin.IconElement = function OoUiMixinIconElement( config ) {
this.icon = null;
this.iconTitle = null;
+ // `iconTitle`s are deprecated since 0.30.0
+ if ( config.iconTitle !== undefined ) {
+ OO.ui.warnDeprecation( 'IconElement: Widgets with iconTitle set are deprecated, use title instead. See T76638 for details.' );
+ }
+
// Initialization
this.setIcon( config.icon || this.constructor.static.icon );
this.setIconTitle( config.iconTitle || this.constructor.static.iconTitle );
@@ -2991,6 +3021,7 @@ OO.ui.mixin.IconElement.prototype.setIcon = function ( icon ) {
* a function that returns title text, or `null` for no title.
* @chainable
* @return {OO.ui.Element} The element, for chaining
+ * @deprecated
*/
OO.ui.mixin.IconElement.prototype.setIconTitle = function ( iconTitle ) {
iconTitle =
@@ -3008,6 +3039,12 @@ OO.ui.mixin.IconElement.prototype.setIconTitle = function ( iconTitle ) {
}
}
+ // `setIconTitle is deprecated since 0.30.0
+ if ( iconTitle !== null ) {
+ // Avoid a warning when this is called from the constructor with no iconTitle set
+ OO.ui.warnDeprecation( 'IconElement: setIconTitle is deprecated, use setTitle of TitledElement instead. See T76638 for details.' );
+ }
+
return this;
};
@@ -3067,6 +3104,11 @@ OO.ui.mixin.IndicatorElement = function OoUiMixinIndicatorElement( config ) {
this.indicator = null;
this.indicatorTitle = null;
+ // `indicatorTitle`s are deprecated since 0.30.0
+ if ( config.indicatorTitle !== undefined ) {
+ OO.ui.warnDeprecation( 'IndicatorElement: Widgets with indicatorTitle set are deprecated, use title instead. See T76638 for details.' );
+ }
+
// Initialization
this.setIndicator( config.indicator || this.constructor.static.indicator );
this.setIndicatorTitle( config.indicatorTitle || this.constructor.static.indicatorTitle );
@@ -3166,6 +3208,7 @@ OO.ui.mixin.IndicatorElement.prototype.setIndicator = function ( indicator ) {
* `null` for no indicator title
* @chainable
* @return {OO.ui.Element} The element, for chaining
+ * @deprecated
*/
OO.ui.mixin.IndicatorElement.prototype.setIndicatorTitle = function ( indicatorTitle ) {
indicatorTitle =
@@ -3183,6 +3226,12 @@ OO.ui.mixin.IndicatorElement.prototype.setIndicatorTitle = function ( indicatorT
}
}
+ // `setIndicatorTitle is deprecated since 0.30.0
+ if ( indicatorTitle !== null ) {
+ // Avoid a warning when this is called from the constructor with no indicatorTitle set
+ OO.ui.warnDeprecation( 'IndicatorElement: setIndicatorTitle is deprecated, use setTitle of TitledElement instead. See T76638 for details.' );
+ }
+
return this;
};
@@ -3215,7 +3264,7 @@ OO.ui.mixin.IndicatorElement.prototype.getIndicatorTitle = function () {
*
* The library currently contains the following styling flags for general use:
*
- * - **progressive**: Progressive styling is applied to convey that the widget will move the user forward in a process.
+ * - **progressive**: Progressive styling is applied to convey that the widget will move the user forward in a process.
* - **destructive**: Destructive styling is applied to convey that the widget will remove something.
*
* The flags affect the appearance of the buttons:
@@ -3223,14 +3272,14 @@ OO.ui.mixin.IndicatorElement.prototype.getIndicatorTitle = function () {
* @example
* // FlaggedElement is mixed into ButtonWidget to provide styling flags
* var button1 = new OO.ui.ButtonWidget( {
- * label: 'Progressive',
- * flags: 'progressive'
- * } );
- * var button2 = new OO.ui.ButtonWidget( {
- * label: 'Destructive',
- * flags: 'destructive'
- * } );
- * $( 'body' ).append( button1.$element, button2.$element );
+ * label: 'Progressive',
+ * flags: 'progressive'
+ * } ),
+ * button2 = new OO.ui.ButtonWidget( {
+ * label: 'Destructive',
+ * flags: 'destructive'
+ * } );
+ * $( document.body ).append( button1.$element, button2.$element );
*
* {@link OO.ui.ActionWidget ActionWidgets}, which are a special kind of button that execute an action, use these flags: **primary** and **safe**.
* Please see the [OOUI documentation on MediaWiki] [1] for more information.
@@ -3421,13 +3470,13 @@ OO.ui.mixin.FlaggedElement.prototype.setFlags = function ( flags ) {
* the mouse over the element. Titles are not visible on touch devices.
*
* @example
- * // TitledElement provides a 'title' attribute to the
- * // ButtonWidget class
+ * // TitledElement provides a `title` attribute to the
+ * // ButtonWidget class.
* var button = new OO.ui.ButtonWidget( {
* label: 'Button with Title',
* title: 'I am a button'
* } );
- * $( 'body' ).append( button.$element );
+ * $( document.body ).append( button.$element );
*
* @abstract
* @class
@@ -3542,19 +3591,19 @@ OO.ui.mixin.TitledElement.prototype.getTitle = function () {
};
/**
- * AccessKeyedElement is mixed into other classes to provide an `accesskey` attribute.
+ * AccessKeyedElement is mixed into other classes to provide an `accesskey` HTML attribute.
* Accesskeys allow an user to go to a specific element by using
* a shortcut combination of a browser specific keys + the key
* set to the field.
*
* @example
- * // AccessKeyedElement provides an 'accesskey' attribute to the
- * // ButtonWidget class
+ * // AccessKeyedElement provides an `accesskey` attribute to the
+ * // ButtonWidget class.
* var button = new OO.ui.ButtonWidget( {
* label: 'Button with Accesskey',
* accessKey: 'k'
* } );
- * $( 'body' ).append( button.$element );
+ * $( document.body ).append( button.$element );
*
* @abstract
* @class
@@ -3695,13 +3744,13 @@ OO.ui.mixin.AccessKeyedElement.prototype.formatTitleWithAccessKey = function ( t
* [1]: https://www.mediawiki.org/wiki/OOUI/Widgets/Buttons_and_Switches
*
* @example
- * // A button widget
+ * // A button widget.
* var button = new OO.ui.ButtonWidget( {
* label: 'Button with Icon',
* icon: 'trash',
* title: 'Remove'
* } );
- * $( 'body' ).append( button.$element );
+ * $( document.body ).append( button.$element );
*
* NOTE: HTML form buttons should use the OO.ui.ButtonInputWidget class.
*
@@ -3921,27 +3970,28 @@ OO.ui.ButtonWidget.prototype.setNoFollow = function ( noFollow ) {
* removed, and cleared from the group.
*
* @example
- * // Example: A ButtonGroupWidget with two buttons
+ * // A ButtonGroupWidget with two buttons.
* var button1 = new OO.ui.PopupButtonWidget( {
- * label: 'Select a category',
- * icon: 'menu',
- * popup: {
- * $content: $( '