File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ export class TapClick {
72
72
this . lastTouchEnd = 0 ;
73
73
this . dispatchClick = true ;
74
74
75
+ if ( this . plt . doc ( ) === ev . target ) {
76
+ this . startCoord = pointerCoord ( ev ) ;
77
+ return true ;
78
+ }
79
+
75
80
let activatableEle = getActivatableTarget ( ev . target ) ;
76
81
if ( ! activatableEle ) {
77
82
this . startCoord = null ;
@@ -97,7 +102,7 @@ export class TapClick {
97
102
if ( ! this . startCoord ) {
98
103
return ;
99
104
}
100
- if ( this . activator ) {
105
+ if ( this . activator && ev . target !== this . plt . doc ( ) ) {
101
106
let activatableEle = getActivatableTarget ( ev . target ) ;
102
107
if ( activatableEle ) {
103
108
this . activator . upAction ( ev , activatableEle , this . startCoord ) ;
@@ -133,7 +138,7 @@ export class TapClick {
133
138
return ;
134
139
}
135
140
136
- if ( this . activator ) {
141
+ if ( this . activator && this . plt . doc ( ) !== ev . target ) {
137
142
// cool, a click is gonna happen, let's tell the activator
138
143
// so the element can get the given "active" style
139
144
const activatableEle = getActivatableTarget ( ev . target ) ;
@@ -235,7 +240,7 @@ export const isActivatable = function (ele: HTMLElement) {
235
240
}
236
241
237
242
for ( let i = 0 , l = ACTIVATABLE_ATTRIBUTES . length ; i < l ; i ++ ) {
238
- if ( ele . hasAttribute ( ACTIVATABLE_ATTRIBUTES [ i ] ) ) {
243
+ if ( ele . hasAttribute && ele . hasAttribute ( ACTIVATABLE_ATTRIBUTES [ i ] ) ) {
239
244
return true ;
240
245
}
241
246
}
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ describe('TapClick', () => {
35
35
expect ( isActivatable ( ele ) ) . toBe ( true ) ;
36
36
} ) ;
37
37
38
+ it ( 'should be not activatable on element without "hasAttribute" function' , ( ) => {
39
+ let doc = document . createDocumentFragment ( ) ;
40
+ expect ( isActivatable ( < any > doc ) ) . toBe ( false ) ;
41
+ } ) ;
42
+
38
43
} ) ;
39
44
40
45
} ) ;
You can’t perform that action at this time.
0 commit comments