From 5589498785d4adaefa83cdccbb804cc9e44941d7 Mon Sep 17 00:00:00 2001 From: karf Date: Fri, 2 Jan 2015 16:09:34 +0100 Subject: [PATCH] fix(kff.Binder): compare change of formatted values, not model values in modelChange method --- src/kff.Binder.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/kff.Binder.js b/src/kff.Binder.js index 758c0e8..0d42677 100644 --- a/src/kff.Binder.js +++ b/src/kff.Binder.js @@ -78,7 +78,7 @@ kff.Binder = kff.createClass( */ modelChange: function(event, force) { - var modelValue; + var modelValue, formattedValue; if(this.modelPathWatcher) { this.model = this.modelPathWatcher.model; @@ -116,9 +116,10 @@ kff.Binder = kff.createClass( } if(modelValue !== 'undefined') { - if(force || !this.compareValues(modelValue, this.currentValue)) + formattedValue = this.format(modelValue); + if(force || !this.compareValues(formattedValue, this.value)) { - this.value = this.format(modelValue); + this.value = formattedValue; this.currentValue = modelValue; this.refresh(); } @@ -178,6 +179,7 @@ kff.Binder = kff.createClass( updateModel: function(value, event) { var i, l; + this.value = value; if(value instanceof Array) { for(i = 0, l = value.length; i < l; i++) value[i] = this.parse(value[i]);