55
66import { isTextInputType } from 'web/util/element'
77import { looseEqual , looseIndexOf } from 'shared/util'
8- import { warn , isAndroid , isIE9 , isIE , isEdge } from 'core/util/index'
98import { mergeVNodeHook } from 'core/vdom/helpers/index'
10- import { emptyNode } from 'core/vdom/patch '
9+ import { warn , isAndroid , isIE9 , isIE , isEdge } from 'core/util/index '
1110
1211/* istanbul ignore if */
1312if ( isIE9 ) {
@@ -24,7 +23,7 @@ const directive = {
2423 inserted ( el , binding , vnode , oldVnode ) {
2524 if ( vnode . tag === 'select' ) {
2625 // #6903
27- if ( oldVnode !== emptyNode && ! hasDirective ( oldVnode , 'model' ) ) {
26+ if ( oldVnode . elm && ! oldVnode . elm . _vOptions ) {
2827 mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'postpatch' , ( ) => {
2928 directive . componentUpdated ( el , binding , vnode )
3029 } )
@@ -51,6 +50,7 @@ const directive = {
5150 }
5251 }
5352 } ,
53+
5454 componentUpdated ( el , binding , vnode ) {
5555 if ( vnode . tag === 'select' ) {
5656 setSelected ( el , binding , vnode . context )
@@ -146,10 +146,4 @@ function trigger (el, type) {
146146 el . dispatchEvent ( e )
147147}
148148
149- function hasDirective ( vnode , dirname ) {
150- return vnode . data &&
151- vnode . data . directives &&
152- vnode . data . directives . some ( dir => dir . name === dirname )
153- }
154-
155149export default directive
0 commit comments