/*!
- * OOUI v0.30.4
+ * OOUI v0.31.0
* https://www.mediawiki.org/wiki/OOUI
*
* Copyright 2011–2019 OOUI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2019-03-07T09:14:18Z
+ * Date: 2019-03-20T23:07:02Z
*/
( function ( OO ) {
this.$element.append( config.content.map( function ( v ) {
if ( typeof v === 'string' ) {
// Escape string so it is properly represented in HTML.
- return document.createTextNode( v );
+ // Don't create empty text nodes for empty strings.
+ return v ? document.createTextNode( v ) : undefined;
} else if ( v instanceof OO.ui.HtmlSnippet ) {
// Bypass escaping.
return v.toString();
this.getElementDocument().removeEventListener( 'mouseup', this.onDocumentMouseUpHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.mixin.ButtonElement.prototype.onMouseUp = function () {
- OO.ui.warnDeprecation( 'onMouseUp is deprecated, use onDocumentMouseUp instead' );
- this.onDocumentMouseUp.apply( this, arguments );
-};
-
/**
* Handles mouse click events.
*
this.getElementDocument().removeEventListener( 'keyup', this.onDocumentKeyUpHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.mixin.ButtonElement.prototype.onKeyUp = function () {
- OO.ui.warnDeprecation( 'onKeyUp is deprecated, use onDocumentKeyUp instead' );
- this.onDocumentKeyUp.apply( this, arguments );
-};
-
/**
* Handles key press events.
*
* { default: 'bold-a', en: 'bold-b', de: 'bold-f' }
* See the [OOUI documentation on MediaWiki] [2] for a list of icons included in the library.
* [2]: https://www.mediawiki.org/wiki/OOUI/Widgets/Icons,_Indicators,_and_Labels#Icons
- * @cfg {string|Function} [iconTitle] A text string used as the icon title, or a function that
- * returns title text. The icon title is displayed when users move the mouse over the icon.
*/
OO.ui.mixin.IconElement = function OoUiMixinIconElement( config ) {
// Configuration initialization
// Properties
this.$icon = null;
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 );
this.setIconElement( config.$icon || $( '<span>' ) );
};
return this;
};
-/**
- * Set the icon title. Use `null` to remove the title.
- *
- * @param {string|Function|null} iconTitle A text string used as the icon title,
- * 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 =
- ( typeof iconTitle === 'function' || ( typeof iconTitle === 'string' && iconTitle.length ) ) ?
- OO.ui.resolveMsg( iconTitle ) : null;
-
- if ( this.iconTitle !== iconTitle ) {
- this.iconTitle = iconTitle;
- if ( this.$icon ) {
- if ( this.iconTitle !== null ) {
- this.$icon.attr( 'title', iconTitle );
- } else {
- this.$icon.removeAttr( 'title' );
- }
- }
- }
-
- // `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;
-};
-
/**
* Get the symbolic name of the icon.
*
* See the [OOUI documentation on MediaWiki][2] for a list of indicators included
* in the library.
* [2]: https://www.mediawiki.org/wiki/OOUI/Widgets/Icons,_Indicators,_and_Labels#Indicators
- * @cfg {string|Function} [indicatorTitle] A text string used as the indicator title,
- * or a function that returns title text. The indicator title is displayed when users move
- * the mouse over the indicator.
*/
OO.ui.mixin.IndicatorElement = function OoUiMixinIndicatorElement( config ) {
// Configuration initialization
// Properties
this.$indicator = null;
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 );
this.setIndicatorElement( config.$indicator || $( '<span>' ) );
};
return this;
};
-/**
- * Set the indicator title.
- *
- * The title is displayed when a user moves the mouse over the indicator.
- *
- * @param {string|Function|null} indicatorTitle Indicator title text, a function that returns text,
- * or `null` for no indicator title
- * @chainable
- * @return {OO.ui.Element} The element, for chaining
- * @deprecated
- */
-OO.ui.mixin.IndicatorElement.prototype.setIndicatorTitle = function ( indicatorTitle ) {
- indicatorTitle =
- ( typeof indicatorTitle === 'function' || ( typeof indicatorTitle === 'string' && indicatorTitle.length ) ) ?
- OO.ui.resolveMsg( indicatorTitle ) : null;
-
- if ( this.indicatorTitle !== indicatorTitle ) {
- this.indicatorTitle = indicatorTitle;
- if ( this.$indicator ) {
- if ( this.indicatorTitle !== null ) {
- this.$indicator.attr( 'title', indicatorTitle );
- } else {
- this.$indicator.removeAttr( 'title' );
- }
- }
- }
-
- // `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;
-};
-
/**
* Get the symbolic name of the indicator (e.g., ‘clear’ or ‘down’).
*
OO.ui.mixin.IconElement.call( this, config );
OO.ui.mixin.IndicatorElement.call( this, config );
OO.ui.mixin.LabelElement.call( this, config );
- OO.ui.mixin.TitledElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.TitledElement.call( this, $.extend( {
$titled: this.$button
- } ) );
+ }, config ) );
OO.ui.mixin.FlaggedElement.call( this, config );
- OO.ui.mixin.TabIndexedElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.TabIndexedElement.call( this, $.extend( {
$tabIndexed: this.$button
- } ) );
- OO.ui.mixin.AccessKeyedElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.AccessKeyedElement.call( this, $.extend( {
$accessKeyed: this.$button
- } ) );
+ }, config ) );
// Properties
this.href = null;
OO.ui.ButtonGroupWidget.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.GroupElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.GroupElement.call( this, $.extend( {
$group: this.$element
- } ) );
+ }, config ) );
OO.ui.mixin.TitledElement.call( this, config );
// Initialization
OO.ui.IconWidget.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.IconElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.IconElement.call( this, $.extend( {
$icon: this.$element
- } ) );
- OO.ui.mixin.TitledElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.TitledElement.call( this, $.extend( {
$titled: this.$element
- } ) );
- OO.ui.mixin.LabelElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.LabelElement.call( this, $.extend( {
$label: this.$element,
invisibleLabel: true
- } ) );
- OO.ui.mixin.FlaggedElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.FlaggedElement.call( this, $.extend( {
$flagged: this.$element
- } ) );
+ }, config ) );
// Initialization
this.$element.addClass( 'oo-ui-iconWidget' );
OO.ui.IndicatorWidget.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.IndicatorElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.IndicatorElement.call( this, $.extend( {
$indicator: this.$element
- } ) );
- OO.ui.mixin.TitledElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.TitledElement.call( this, $.extend( {
$titled: this.$element
- } ) );
- OO.ui.mixin.LabelElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.LabelElement.call( this, $.extend( {
$label: this.$element,
invisibleLabel: true
- } ) );
+ }, config ) );
// Initialization
this.$element.addClass( 'oo-ui-indicatorWidget' );
OO.ui.LabelWidget.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.LabelElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.LabelElement.call( this, $.extend( {
$label: this.$element
- } ) );
+ }, config ) );
OO.ui.mixin.TitledElement.call( this, config );
// Properties
// Mixin constructors
OO.ui.mixin.LabelElement.call( this, config );
- OO.ui.mixin.ClippableElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.ClippableElement.call( this, $.extend( {
$clippable: this.$body,
$clippableContainer: this.$popup
- } ) );
+ }, config ) );
OO.ui.mixin.FloatableElement.call( this, config );
// Properties
}
};
-// Deprecated alias since 0.28.3
-OO.ui.PopupWidget.prototype.onMouseDown = function () {
- OO.ui.warnDeprecation( 'onMouseDown is deprecated, use onDocumentMouseDown instead' );
- this.onDocumentMouseDown.apply( this, arguments );
-};
-
/**
* Bind document mouse down listener.
*
this.getElementDocument().addEventListener( 'click', this.onDocumentMouseDownHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.PopupWidget.prototype.bindMouseDownListener = function () {
- OO.ui.warnDeprecation( 'bindMouseDownListener is deprecated, use bindDocumentMouseDownListener instead' );
- this.bindDocumentMouseDownListener.apply( this, arguments );
-};
-
/**
* Handles close button click events.
*
this.getElementDocument().removeEventListener( 'click', this.onDocumentMouseDownHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.PopupWidget.prototype.unbindMouseDownListener = function () {
- OO.ui.warnDeprecation( 'unbindMouseDownListener is deprecated, use unbindDocumentMouseDownListener instead' );
- this.unbindDocumentMouseDownListener.apply( this, arguments );
-};
-
/**
* Handles document key down events.
*
this.getElementDocument().addEventListener( 'keydown', this.onDocumentKeyDownHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.PopupWidget.prototype.bindKeyDownListener = function () {
- OO.ui.warnDeprecation( 'bindKeyDownListener is deprecated, use bindDocumentKeyDownListener instead' );
- this.bindDocumentKeyDownListener.apply( this, arguments );
-};
-
/**
* Unbind document key down listener.
*
this.getElementDocument().removeEventListener( 'keydown', this.onDocumentKeyDownHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.PopupWidget.prototype.unbindKeyDownListener = function () {
- OO.ui.warnDeprecation( 'unbindKeyDownListener is deprecated, use unbindDocumentKeyDownListener instead' );
- this.unbindDocumentKeyDownListener.apply( this, arguments );
-};
-
/**
* Show, hide, or toggle the visibility of the anchor.
*
OO.ui.mixin.TitledElement.call( this, config );
// Properties
- this.selected = false;
this.highlighted = false;
this.pressed = false;
+ this.setSelected( !!config.selected );
// Initialization
this.$element
// Allow programmatic focussing (and by access key), but not tabbing
.attr( 'tabindex', '-1' )
.attr( 'role', 'option' )
- .attr( 'aria-selected', 'false' )
.addClass( 'oo-ui-optionWidget' )
.append( this.$label );
};
OO.ui.SelectWidget.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.GroupWidget.call( this, $.extend( {}, config, {
+ OO.ui.mixin.GroupWidget.call( this, $.extend( {
$group: this.$element
- } ) );
+ }, config ) );
// Properties
this.pressed = false;
return false;
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.onMouseUp = function () {
- OO.ui.warnDeprecation( 'onMouseUp is deprecated, use onDocumentMouseUp instead' );
- this.onDocumentMouseUp.apply( this, arguments );
-};
-
/**
* Handle document mouse move events.
*
}
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.onMouseMove = function () {
- OO.ui.warnDeprecation( 'onMouseMove is deprecated, use onDocumentMouseMove instead' );
- this.onDocumentMouseMove.apply( this, arguments );
-};
-
/**
* Handle mouse over events.
*
}
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.onKeyDown = function () {
- OO.ui.warnDeprecation( 'onKeyDown is deprecated, use onDocumentKeyDown instead' );
- this.onDocumentKeyDown.apply( this, arguments );
-};
-
/**
* Bind document key down listener.
*
this.getElementDocument().addEventListener( 'keydown', this.onDocumentKeyDownHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.bindKeyDownListener = function () {
- OO.ui.warnDeprecation( 'bindKeyDownListener is deprecated, use bindDocumentKeyDownListener instead' );
- this.bindDocumentKeyDownListener.apply( this, arguments );
-};
-
/**
* Unbind document key down listener.
*
this.getElementDocument().removeEventListener( 'keydown', this.onDocumentKeyDownHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.unbindKeyDownListener = function () {
- OO.ui.warnDeprecation( 'unbindKeyDownListener is deprecated, use unbindDocumentKeyDownListener instead' );
- this.unbindDocumentKeyDownListener.apply( this, arguments );
-};
-
/**
* Scroll item into view, preventing spurious mouse highlight actions from happening.
*
e.stopPropagation();
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.onKeyPress = function () {
- OO.ui.warnDeprecation( 'onKeyPress is deprecated, use onDocumentKeyPress instead' );
- this.onDocumentKeyPress.apply( this, arguments );
-};
-
/**
* Get a matcher for the specific string
*
this.getElementDocument().addEventListener( 'keypress', this.onDocumentKeyPressHandler, true );
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.bindKeyPressListener = function () {
- OO.ui.warnDeprecation( 'bindKeyPressListener is deprecated, use bindDocumentKeyPressListener instead' );
- this.bindDocumentKeyPressListener.apply( this, arguments );
-};
-
/**
* Unbind document key down listener.
*
this.clearKeyPressBuffer();
};
-// Deprecated alias since 0.28.3
-OO.ui.SelectWidget.prototype.unbindKeyPressListener = function () {
- OO.ui.warnDeprecation( 'unbindKeyPressListener is deprecated, use unbindDocumentKeyPressListener instead' );
- this.unbindDocumentKeyPressListener.apply( this, arguments );
-};
-
/**
* Visibility change handler
*
this.$element
.addClass( 'oo-ui-menuSectionOptionWidget' )
.removeAttr( 'role aria-selected' );
+ this.selected = false;
};
/* Setup */
OO.ui.MenuSelectWidget.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.ClippableElement.call( this, $.extend( {}, config, { $clippable: this.$group } ) );
+ OO.ui.mixin.ClippableElement.call( this, $.extend( { $clippable: this.$group }, config ) );
OO.ui.mixin.FloatableElement.call( this, config );
// Initial vertical positions other than 'center' will result in
OO.ui.mixin.IconElement.call( this, config );
OO.ui.mixin.IndicatorElement.call( this, config );
OO.ui.mixin.LabelElement.call( this, config );
- OO.ui.mixin.TitledElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.TitledElement.call( this, $.extend( {
$titled: this.$label
- } ) );
- OO.ui.mixin.TabIndexedElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.TabIndexedElement.call( this, $.extend( {
$tabIndexed: this.$handle
- } ) );
+ }, config ) );
// Properties
this.menu = new OO.ui.MenuSelectWidget( $.extend( {
* @abstract
* @class
* @extends OO.ui.Widget
- * @mixins OO.ui.mixin.FlaggedElement
* @mixins OO.ui.mixin.TabIndexedElement
* @mixins OO.ui.mixin.TitledElement
* @mixins OO.ui.mixin.AccessKeyedElement
this.inputFilter = config.inputFilter;
// Mixin constructors
- OO.ui.mixin.FlaggedElement.call( this, config );
- OO.ui.mixin.TabIndexedElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.TabIndexedElement.call( this, $.extend( {
$tabIndexed: this.$input
- } ) );
- OO.ui.mixin.TitledElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.TitledElement.call( this, $.extend( {
$titled: this.$input
- } ) );
- OO.ui.mixin.AccessKeyedElement.call( this, $.extend( {}, config, {
+ }, config ) );
+ OO.ui.mixin.AccessKeyedElement.call( this, $.extend( {
$accessKeyed: this.$input
- } ) );
+ }, config ) );
// Events
this.$input.on( 'keydown mouseup cut paste change input select', this.onEdit.bind( this ) );
/* Setup */
OO.inheritClass( OO.ui.InputWidget, OO.ui.Widget );
-OO.mixinClass( OO.ui.InputWidget, OO.ui.mixin.FlaggedElement );
OO.mixinClass( OO.ui.InputWidget, OO.ui.mixin.TabIndexedElement );
OO.mixinClass( OO.ui.InputWidget, OO.ui.mixin.TitledElement );
OO.mixinClass( OO.ui.InputWidget, OO.ui.mixin.AccessKeyedElement );
* @mixins OO.ui.mixin.IconElement
* @mixins OO.ui.mixin.IndicatorElement
* @mixins OO.ui.mixin.LabelElement
+ * @mixins OO.ui.mixin.FlaggedElement
*
* @constructor
* @param {Object} [config] Configuration options
OO.ui.ButtonInputWidget.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.ButtonElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.ButtonElement.call( this, $.extend( {
$button: this.$input
- } ) );
+ }, config ) );
OO.ui.mixin.IconElement.call( this, config );
OO.ui.mixin.IndicatorElement.call( this, config );
OO.ui.mixin.LabelElement.call( this, config );
+ OO.ui.mixin.FlaggedElement.call( this, config );
// Initialization
if ( !config.useInputTag ) {
OO.mixinClass( OO.ui.ButtonInputWidget, OO.ui.mixin.IconElement );
OO.mixinClass( OO.ui.ButtonInputWidget, OO.ui.mixin.IndicatorElement );
OO.mixinClass( OO.ui.ButtonInputWidget, OO.ui.mixin.LabelElement );
+OO.mixinClass( OO.ui.ButtonInputWidget, OO.ui.mixin.FlaggedElement );
/* Static Properties */
* @mixins OO.ui.mixin.IndicatorElement
* @mixins OO.ui.mixin.PendingElement
* @mixins OO.ui.mixin.LabelElement
+ * @mixins OO.ui.mixin.FlaggedElement
*
* @constructor
* @param {Object} [config] Configuration options
// Mixin constructors
OO.ui.mixin.IconElement.call( this, config );
OO.ui.mixin.IndicatorElement.call( this, config );
- OO.ui.mixin.PendingElement.call( this, $.extend( {}, config, { $pending: this.$input } ) );
+ OO.ui.mixin.PendingElement.call( this, $.extend( { $pending: this.$input }, config ) );
OO.ui.mixin.LabelElement.call( this, config );
+ OO.ui.mixin.FlaggedElement.call( this, config );
// Properties
this.type = this.getSaneType( config );
OO.mixinClass( OO.ui.TextInputWidget, OO.ui.mixin.IndicatorElement );
OO.mixinClass( OO.ui.TextInputWidget, OO.ui.mixin.PendingElement );
OO.mixinClass( OO.ui.TextInputWidget, OO.ui.mixin.LabelElement );
+OO.mixinClass( OO.ui.TextInputWidget, OO.ui.mixin.FlaggedElement );
/* Static Properties */
* displayed below the widget.
* @cfg {Array} [warnings] Warning messages about the widget, which will be
* displayed below the widget.
+ * @cfg {Array} [successMessages] Success messages on user interactions with the widget,
+ * which will be displayed below the widget.
* The array may contain strings or OO.ui.HtmlSnippet instances.
* @cfg {Array} [notices] Notices about the widget, which will be displayed
* below the widget.
OO.ui.FieldLayout.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.LabelElement.call( this, $.extend( {}, config, {
+ OO.ui.mixin.LabelElement.call( this, $.extend( {
$label: $( '<label>' )
- } ) );
- OO.ui.mixin.TitledElement.call( this, $.extend( {}, config, { $titled: this.$label } ) );
+ }, config ) );
+ OO.ui.mixin.TitledElement.call( this, $.extend( { $titled: this.$label }, config ) );
// Properties
this.fieldWidget = fieldWidget;
this.errors = [];
this.warnings = [];
+ this.successMessages = [];
this.notices = [];
this.$field = this.isFieldInline() ? $( '<span>' ) : $( '<div>' );
this.$messages = $( '<ul>' );
this.setErrors( config.errors || [] );
this.setWarnings( config.warnings || [] );
+ this.setSuccess( config.successMessages || [] );
this.setNotices( config.notices || [] );
this.setAlignment( config.align );
// Call this again to take into account the widget's accessKey
} else if ( kind === 'warning' ) {
$icon = new OO.ui.IconWidget( { icon: 'alert', flags: [ 'warning' ] } ).$element;
$listItem.attr( 'role', 'alert' );
+ } else if ( kind === 'success' ) {
+ $icon = new OO.ui.IconWidget( { icon: 'check', flags: [ 'success' ] } ).$element;
} else if ( kind === 'notice' ) {
$icon = new OO.ui.IconWidget( { icon: 'notice' } ).$element;
} else {
return this;
};
+/**
+ * Set the list of success messages.
+ *
+ * @param {Array} successMessages Success messages about the widget, which will be displayed below
+ * the widget.
+ * The array may contain strings or OO.ui.HtmlSnippet instances.
+ * @chainable
+ * @return {OO.ui.BookletLayout} The layout, for chaining
+ */
+OO.ui.FieldLayout.prototype.setSuccess = function ( successMessages ) {
+ this.successMessages = successMessages.slice();
+ this.updateMessages();
+ return this;
+};
+
/**
* Set the list of notice messages.
*
};
/**
- * Update the rendering of error, warning and notice messages.
+ * Update the rendering of error, warning, success and notice messages.
*
* @private
*/
var i;
this.$messages.empty();
- if ( this.errors.length || this.warnings.length || this.notices.length ) {
+ if (
+ this.errors.length ||
+ this.warnings.length ||
+ this.successMessages.length ||
+ this.notices.length
+ ) {
this.$body.after( this.$messages );
} else {
this.$messages.remove();
for ( i = 0; i < this.warnings.length; i++ ) {
this.$messages.append( this.makeMessage( 'warning', this.warnings[ i ] ) );
}
+ for ( i = 0; i < this.successMessages.length; i++ ) {
+ this.$messages.append( this.makeMessage( 'success', this.successMessages[ i ] ) );
+ }
for ( i = 0; i < this.notices.length; i++ ) {
this.$messages.append( this.makeMessage( 'notice', this.notices[ i ] ) );
}
OO.ui.FormLayout.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.GroupElement.call( this, $.extend( {}, config, { $group: this.$element } ) );
+ OO.ui.mixin.GroupElement.call( this, $.extend( { $group: this.$element }, config ) );
// Events
this.$element.on( 'submit', this.onFormSubmit.bind( this ) );
OO.inheritClass( OO.ui.PanelLayout, OO.ui.Layout );
+/* Static Methods */
+
+/**
+ * @inheritdoc
+ */
+OO.ui.PanelLayout.static.reusePreInfuseDOM = function ( node, config ) {
+ config = OO.ui.PanelLayout.parent.static.reusePreInfuseDOM( node, config );
+ if ( config.preserveContent !== false ) {
+ config.$content = $( node ).contents();
+ }
+ return config;
+};
+
/* Methods */
/**
OO.ui.HorizontalLayout.parent.call( this, config );
// Mixin constructors
- OO.ui.mixin.GroupElement.call( this, $.extend( {}, config, { $group: this.$element } ) );
+ OO.ui.mixin.GroupElement.call( this, $.extend( { $group: this.$element }, config ) );
// Initialization
this.$element.addClass( 'oo-ui-horizontalLayout' );