File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change 97
97
return ta ;
98
98
}
99
99
100
- function deepTargetFind ( x , y ) {
101
- var node = document . elementFromPoint ( x , y ) ;
102
- // this code path is only taken when native ShadowDOM is used
103
- var next = node . shadowRoot ;
104
- while ( next ) {
105
- next = next . elementFromPoint ( x , y ) ;
106
- if ( next ) {
107
- node = next ;
108
- next = next . shadowRoot ;
109
- }
100
+ function deepTargetFind ( x , y , root ) {
101
+ root = root || document ;
102
+ var node = root . elementFromPoint ( x , y ) ;
103
+ var sr ;
104
+ if ( node ) {
105
+ sr = node . shadowRoot ;
110
106
}
111
- return node ;
107
+ // if there is not a shadowroot, we are done
108
+ // if there is a shadowroot, it may have a node at x/y
109
+ // if there is a node at x/y in the shadowroot, return it
110
+ // otherwise, return this node
111
+ return sr ? ( deepTargetFind ( x , y , sr ) || node ) : node ;
112
112
}
113
113
114
114
var Gestures = {
You can’t perform that action at this time.
0 commit comments