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

Change subject: InputWidget: Update DOM value before firing 'change' event
......................................................................


InputWidget: Update DOM value before firing 'change' event

It seems sensible not to fire events while the object is in
inconsistent state.

It was previously done in this order before 8b32c7d2 was done to fix
the behavior when #cleanUpValue is not a no-op.

Change-Id: I5cc59b5c2682ece6b0df303c07b0c4dfa32d95ed
---
M src/widgets/InputWidget.js
1 file changed, 5 insertions(+), 5 deletions(-)

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



diff --git a/src/widgets/InputWidget.js b/src/widgets/InputWidget.js
index c0fa123..875aee7 100644
--- a/src/widgets/InputWidget.js
+++ b/src/widgets/InputWidget.js
@@ -111,14 +111,14 @@
  */
 OO.ui.InputWidget.prototype.setValue = function ( value ) {
        value = this.cleanUpValue( value );
+       // Update the DOM if it has changed. Note that with cleanUpValue, it
+       // is possible for the DOM value to change without this.value changing.
+       if ( this.$input.val() !== value ) {
+               this.$input.val( value );
+       }
        if ( this.value !== value ) {
                this.value = value;
                this.emit( 'change', this.value );
-       }
-       // Update the DOM if it has changed. Note that with cleanUpValue, it
-       // is possible for the DOM value to change without this.value changing.
-       if ( this.$input.val() !== this.value ) {
-               this.$input.val( this.value );
        }
        return this;
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5cc59b5c2682ece6b0df303c07b0c4dfa32d95ed
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to