/*!
- * OOjs UI v0.16.1
+ * OOjs UI v0.16.2
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2016 OOjs UI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2016-03-01T21:50:12Z
+ * Date: 2016-03-08T21:46:49Z
*/
( function ( OO ) {
* @param {Mixed[]} datas Data of the now-selected items
*/
+/**
+ * @event resize
+ *
+ * A resize event is emitted when the widget's dimensions change to accomodate newly added items or
+ * current user input.
+ */
+
/* Methods */
/**
}
if ( !same ) {
this.emit( 'change', this.getItemsData() );
- this.menu.position();
+ this.updateIfHeightChanged();
}
return this;
}
if ( !same ) {
this.emit( 'change', this.getItemsData() );
- this.menu.position();
+ this.updateIfHeightChanged();
}
return this;
if ( this.items.length ) {
OO.ui.mixin.GroupElement.prototype.clearItems.call( this );
this.emit( 'change', this.getItemsData() );
- this.menu.position();
+ this.updateIfHeightChanged();
}
return this;
};
bestWidth = this.$content.innerWidth() - 10;
}
this.$input.width( Math.floor( bestWidth ) );
+ this.updateIfHeightChanged();
+ }
+};
+/**
+ * Determine if widget height changed, and if so, update menu position and emit 'resize' event.
+ *
+ * @private
+ */
+OO.ui.CapsuleMultiSelectWidget.prototype.updateIfHeightChanged = function () {
+ var height = this.$element.height();
+ if ( height !== this.height ) {
+ this.height = height;
this.menu.position();
+ this.emit( 'resize' );
}
};