Browse Source

Prevent setting unchanged value of input on blur (#3077)

Fix #3029
Force setting the value actually resets selectionStart and selectionEnd
No test is added because you cannot simulate the bug by using
input.blur()
Eduardo San Martin Morote 10 years ago
parent
commit
ab675781fb
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/directives/public/model/text.js

+ 4 - 1
src/directives/public/model/text.js

@@ -129,7 +129,10 @@ export default {
   },
 
   update (value) {
-    this.el.value = _toString(value)
+    // #3029 only update when the value changes. This prevent
+    // browsers from overwriting values like selectionStart
+    value = _toString(value)
+    if (value !== this.el.value) this.el.value = value
   },
 
   unbind () {