mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Simplify partly redundant findFirstSelectedItem implementation"
This commit is contained in:
commit
a1bd30f35d
|
@ -4,6 +4,10 @@
|
|||
*
|
||||
* @class
|
||||
* @extends OO.ui.OptionWidget
|
||||
* @mixins OO.ui.mixin.ButtonElement
|
||||
* @mixins OO.ui.mixin.IconElement
|
||||
* @mixins OO.ui.mixin.TabIndexedElement
|
||||
* @mixins ve.ui.MWAriaDescribe
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} config
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
*
|
||||
* @class
|
||||
* @extends OO.ui.SelectWidget
|
||||
* @mixins OO.ui.mixin.TabIndexedElement
|
||||
* @mixins ve.ui.MWAriaDescribe
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} config
|
||||
|
@ -92,17 +94,8 @@ ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.addItems = function (
|
|||
* @return {ve.ui.MWTransclusionOutlineParameterWidget|null}
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.findFirstSelectedItem = function () {
|
||||
var firstSelected;
|
||||
|
||||
this.items.some( function ( item ) {
|
||||
if ( !firstSelected && item.isSelected() ) {
|
||||
firstSelected = item;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} );
|
||||
|
||||
return firstSelected;
|
||||
var selected = this.findSelectedItems();
|
||||
return Array.isArray( selected ) ? selected[ 0 ] || null : selected;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue