Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/189755

Change subject: PopupWidget: Set $clippable only once, correctly
......................................................................

PopupWidget: Set $clippable only once, correctly

Previously we didn't pass the $clippable option to constructor,
setting clippable element to this.$element (ClippableElement
constructor called#setClippableElement). Then we built the DOM and
called #setClippableElement again ourselves, with this.$body, which
would then have to unset the existing clippable element first
(this.$element), which called OO.ui.Element.static.reconsiderScrollbars,
which is slow.

Bug: T89082
Change-Id: Ide21478276302bfb654d49563fec282bd3ee70be
---
M src/widgets/PopupWidget.js
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/55/189755/1

diff --git a/src/widgets/PopupWidget.js b/src/widgets/PopupWidget.js
index 21a3c71..a7432ac 100644
--- a/src/widgets/PopupWidget.js
+++ b/src/widgets/PopupWidget.js
@@ -26,14 +26,16 @@
        // Parent constructor
        OO.ui.PopupWidget.super.call( this, config );
 
+       // Properties (must be set before ClippableElement constructor call)
+       this.$body = $( '<div>' );
+
        // Mixin constructors
        OO.ui.LabelElement.call( this, config );
-       OO.ui.ClippableElement.call( this, config );
+       OO.ui.ClippableElement.call( this, $.extend( {}, config, { $clippable: 
this.$body } ) );
 
        // Properties
        this.$popup = $( '<div>' );
        this.$head = $( '<div>' );
-       this.$body = $( '<div>' );
        this.$anchor = $( '<div>' );
        // If undefined, will be computed lazily in updateDimensions()
        this.$container = config.$container;
@@ -74,8 +76,6 @@
        if ( config.padded ) {
                this.$body.addClass( 'oo-ui-popupWidget-body-padded' );
        }
-
-       this.setClippableElement( this.$body );
 
        // Initially hidden - using #toggle may cause errors if subclasses 
override toggle with methods
        // that reference properties not initialized at that time of parent 
class construction

-- 
To view, visit https://gerrit.wikimedia.org/r/189755
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide21478276302bfb654d49563fec282bd3ee70be
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to