jenkins-bot has submitted this change and it was merged.

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


PopupWidget: Set $clippable only once, correctly

Previously we didn't pass the $clippable option to the constructor,
setting the clippable element to this.$element (the 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(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: Ide21478276302bfb654d49563fec282bd3ee70be
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to