[MediaWiki-commits] [Gerrit] InputWidget: Update DOM value before firing 'change' event - change (oojs/ui)
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 matma@gmail.com Gerrit-Reviewer: Trevor Parscal tpars...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] InputWidget: Update DOM value before firing 'change' event - change (oojs/ui)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/176478 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(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/78/176478/1 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: newchange Gerrit-Change-Id: I5cc59b5c2682ece6b0df303c07b0c4dfa32d95ed Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits