@@ -17,6 +17,7 @@ import WrapperArray from './wrapper-array'
17
17
import ErrorWrapper from './error-wrapper'
18
18
import { throwError , warn } from '../lib/util'
19
19
import findAll from '../lib/find'
20
+ import createWrapper from './create-wrapper'
20
21
21
22
export default class Wrapper implements BaseWrapper {
22
23
vnode : VNode ;
@@ -66,7 +67,8 @@ export default class Wrapper implements BaseWrapper {
66
67
Object . keys ( this . vm . $style ) . forEach ( ( key ) => {
67
68
// $FlowIgnore : Flow thinks vm is a property
68
69
moduleIdent = this . vm . $style [ key ]
69
- // CSS Modules may be multi-class if they extend others. Extended classes should be already present in $style.
70
+ // CSS Modules may be multi-class if they extend others.
71
+ // Extended classes should be already present in $style.
70
72
moduleIdent = moduleIdent . split ( ' ' ) [ 0 ]
71
73
cssModuleIdentifiers [ moduleIdent ] = key
72
74
} )
@@ -227,9 +229,7 @@ export default class Wrapper implements BaseWrapper {
227
229
}
228
230
return new ErrorWrapper ( typeof selector === 'string' ? selector : 'Component' )
229
231
}
230
- return nodes [ 0 ] instanceof Vue
231
- ? new VueWrapper ( nodes [ 0 ] , this . options )
232
- : new Wrapper ( nodes [ 0 ] , this . update , this . options )
232
+ return createWrapper ( nodes [ 0 ] , this . update , this . options )
233
233
}
234
234
235
235
/**
@@ -238,10 +238,9 @@ export default class Wrapper implements BaseWrapper {
238
238
findAll ( selector : Selector ) : WrapperArray {
239
239
const selectorType = getSelectorTypeOrThrow ( selector , 'findAll' )
240
240
const nodes = findAll ( this . vm , this . vnode , selectorType , selector )
241
- const wrappers = nodes [ 0 ] && nodes [ 0 ] instanceof Vue
242
- ? nodes . map ( node => new VueWrapper ( node , this . options ) )
243
- : nodes . map ( node => new Wrapper ( node , this . update , this . options ) )
244
-
241
+ const wrappers = nodes . map ( node =>
242
+ createWrapper ( node , this . update , this . options )
243
+ )
245
244
return new WrapperArray ( wrappers )
246
245
}
247
246
0 commit comments