Prtksxna has uploaded a new change for review.

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

Change subject: TextInputWidget: Stop adjustSize if the value of the textarea 
is the same
......................................................................

TextInputWidget: Stop adjustSize if the value of the textarea is the same

As adjustSize gets called onEdit it was getting called multiple
times per keystroke. This prevents the method from being executed
if the value of the textarea hasn't changed.

Bug: T75328
Change-Id: I51e58c8b07e87479ac17910145824d768025c05e
---
M src/widgets/TextInputWidget.js
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/75/176475/1

diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index 5c16a6e..9b0da89 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -201,12 +201,13 @@
 OO.ui.TextInputWidget.prototype.adjustSize = function () {
        var $clone, scrollHeight, innerHeight, outerHeight, maxInnerHeight, 
measurementError, idealHeight;
 
-       if ( this.multiline && this.autosize ) {
+       if ( this.multiline && this.autosize && this.$input.val() !== 
this.valCache ) {
                $clone = this.$input.clone()
                        .val( this.$input.val() )
                        // Set inline height property to 0 to measure scroll 
height
                        .css( 'height', 0 )
                        .insertAfter( this.$input );
+               this.valCache = this.$input.val();
                scrollHeight = $clone[0].scrollHeight;
                // Remove inline height property to measure natural heights
                $clone.css( 'height', '' );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I51e58c8b07e87479ac17910145824d768025c05e
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <psax...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to