File tree 3 files changed +4
-35
lines changed
3 files changed +4
-35
lines changed Original file line number Diff line number Diff line change @@ -90,20 +90,7 @@ export function vmFunctionalCtorMatchesSelector (
90
90
return Ctors.some(c => Ctor [ c ] === component [ FUNCTIONAL_OPTIONS ] . _Ctor [ c ] )
91
91
}
92
92
93
- export function findVueComponentByElement (
94
- vm : Component ,
95
- elem : Element
96
- ) : ?Component {
97
- const components = findAllVueComponentsFromVm ( vm )
98
- for ( let i = 0 , max = components . length ; i < max ; i ++ ) {
99
- const component = components [ i ]
100
- if ( component . $el === elem ) {
101
- return component
102
- }
103
- }
104
- }
105
-
106
- export function findVueComponents (
93
+ export default function findVueComponents (
107
94
root : Component ,
108
95
selectorType : ?string ,
109
96
selector : Object
Original file line number Diff line number Diff line change 1
1
// @flow
2
2
3
3
import findVnodes from './find-vnodes'
4
- import {
5
- findVueComponents ,
6
- findVueComponentByElement
7
- } from './find-vue-components'
4
+ import findVueComponents from './find-vue-components'
8
5
import findDOMNodes from './find-dom-nodes'
9
6
import { COMPONENT_SELECTOR , NAME_SELECTOR , DOM_SELECTOR } from './consts'
10
7
import Vue from 'vue'
11
8
import getSelectorTypeOrThrow from './get-selector-type'
12
9
import { throwError } from 'shared/util'
13
10
14
- // Returns a component if the element binds a Vue instance.
15
- function replaceBindingComponent ( vnode : VNode ) : VNode | Component {
16
- if ( vnode . elm && vnode . elm . __vue__ ) {
17
- const component =
18
- findVueComponentByElement ( vnode . elm . __vue__ . $root , vnode . elm )
19
- if ( component ) {
20
- return component
21
- }
22
- }
23
- return vnode
24
- }
25
-
26
11
export default function find (
27
12
vm : Component | null ,
28
13
vnode : VNode | null ,
@@ -58,14 +43,11 @@ export default function find (
58
43
59
44
if ( vnode ) {
60
45
const nodes = findVnodes ( vnode , vm , selectorType , selector )
61
- . map ( replaceBindingComponent )
62
46
if ( selectorType !== DOM_SELECTOR ) {
63
47
return nodes
64
48
}
65
49
return nodes . length > 0 ? nodes : findDOMNodes ( element , selector )
66
- . map ( replaceBindingComponent )
67
50
}
68
51
69
52
return findDOMNodes ( element , selector )
70
- . map ( replaceBindingComponent )
71
53
}
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ export default class Wrapper implements BaseWrapper {
325
325
}
326
326
// Using CSS Selector, returns a VueWrapper instance if the root element
327
327
// binds a Vue instance.
328
- if ( nodes [ 0 ] . $el === this . element && nodes [ 0 ] . $parent === undefined ) {
328
+ if ( nodes [ 0 ] . elm === this . element ) {
329
329
return this
330
330
}
331
331
return createWrapper ( nodes [ 0 ] , this . options )
@@ -341,7 +341,7 @@ export default class Wrapper implements BaseWrapper {
341
341
const wrappers = nodes . map ( node => {
342
342
// Using CSS Selector, returns a VueWrapper instance if the root element
343
343
// binds a Vue instance.
344
- return node . $el === this . element && node . $parent === undefined
344
+ return node . elm === this . element
345
345
? this
346
346
: createWrapper ( node , this . options )
347
347
} )
You can’t perform that action at this time.
0 commit comments