Skip to content

Commit ab67578

Browse files
posvayyx990803
authored andcommitted
Prevent setting unchanged value of input on blur (vuejs#3077)
Fix vuejs#3029 Force setting the value actually resets selectionStart and selectionEnd No test is added because you cannot simulate the bug by using input.blur()
1 parent 83d37b0 commit ab67578

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/directives/public/model/text.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ export default {
129129
},
130130

131131
update (value) {
132-
this.el.value = _toString(value)
132+
// #3029 only update when the value changes. This prevent
133+
// browsers from overwriting values like selectionStart
134+
value = _toString(value)
135+
if (value !== this.el.value) this.el.value = value
133136
},
134137

135138
unbind () {

0 commit comments

Comments
 (0)