@@ -30,6 +30,7 @@ export default {
30
30
if ( isIE || isEdge ) {
31
31
setTimeout ( cb , 0 )
32
32
}
33
+ el . _vOptions = [ ] . map . call ( el . options , getValue )
33
34
} else if ( vnode . tag === 'textarea' || isTextInputType ( el . type ) ) {
34
35
el . _vModifiers = binding . modifiers
35
36
if ( ! binding . modifiers . lazy ) {
@@ -56,10 +57,9 @@ export default {
56
57
// it's possible that the value is out-of-sync with the rendered options.
57
58
// detect such cases and filter out values that no longer has a matching
58
59
// option in the DOM.
59
- const needReset = el . multiple
60
- ? binding . value . some ( v => hasNoMatchingOption ( v , el . options ) )
61
- : binding . value !== binding . oldValue && hasNoMatchingOption ( binding . value , el . options )
62
- if ( needReset ) {
60
+ const prevOptions = el . _vOptions
61
+ const curOptions = el . _vOptions = [ ] . map . call ( el . options , getValue )
62
+ if ( curOptions . some ( ( o , i ) => ! looseEqual ( o , prevOptions [ i ] ) ) ) {
63
63
trigger ( el , 'change' )
64
64
}
65
65
}
@@ -101,15 +101,6 @@ function setSelected (el, binding, vm) {
101
101
}
102
102
}
103
103
104
- function hasNoMatchingOption ( value , options ) {
105
- for ( let i = 0 , l = options . length ; i < l ; i ++ ) {
106
- if ( looseEqual ( getValue ( options [ i ] ) , value ) ) {
107
- return false
108
- }
109
- }
110
- return true
111
- }
112
-
113
104
function getValue ( option ) {
114
105
return '_value' in option
115
106
? option . _value
0 commit comments