Просмотр исходного кода

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 лет назад
Родитель
Сommit
ab675781fb
1 измененных файлов с 4 добавлено и 1 удалено
  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 () {