/*!
- * OOjs UI v0.17.10
+ * OOjs UI v0.18.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-10-03T18:59:01Z
+ * Date: 2016-12-06T23:32:53Z
*/
( function ( OO ) {
this.$bar = $( '<div>' );
this.$actions = $( '<div>' );
this.initialized = false;
+ this.narrowThreshold = null;
this.onWindowResizeHandler = this.onWindowResize.bind( this );
// Events
OO.ui.Toolbar.prototype.onWindowResize = function () {
this.$element.toggleClass(
'oo-ui-toolbar-narrow',
- this.$bar.width() <= this.narrowThreshold
+ this.$bar.width() <= this.getNarrowThreshold()
);
};
+/**
+ * Get the (lazily-computed) width threshold for applying the oo-ui-toolbar-narrow
+ * class.
+ *
+ * @private
+ * @return {number} Width threshold in pixels
+ */
+OO.ui.Toolbar.prototype.getNarrowThreshold = function () {
+ if ( this.narrowThreshold === null ) {
+ this.narrowThreshold = this.$group.width() + this.$actions.width();
+ }
+ return this.narrowThreshold;
+};
+
/**
* Sets up handles and preloads required information for the toolbar to work.
* This must be called after it is attached to a visible document and before doing anything else.
OO.ui.Toolbar.prototype.initialize = function () {
if ( !this.initialized ) {
this.initialized = true;
- this.narrowThreshold = this.$group.width() + this.$actions.width();
$( this.getElementWindow() ).on( 'resize', this.onWindowResizeHandler );
this.onWindowResize();
}
*
* When active, the popup is visible. A mouseup event anywhere in the document will trigger
* deactivation.
+ *
+ * @param {boolean} value The active state to set
*/
OO.ui.PopupToolGroup.prototype.setActive = function ( value ) {
var containerWidth, containerLeft;