mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
@ -72,6 +72,11 @@ export class TapClick {
|
|||||||
this.lastTouchEnd = 0;
|
this.lastTouchEnd = 0;
|
||||||
this.dispatchClick = true;
|
this.dispatchClick = true;
|
||||||
|
|
||||||
|
if (this.plt.doc() === ev.target) {
|
||||||
|
this.startCoord = pointerCoord(ev);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
let activatableEle = getActivatableTarget(ev.target);
|
let activatableEle = getActivatableTarget(ev.target);
|
||||||
if (!activatableEle) {
|
if (!activatableEle) {
|
||||||
this.startCoord = null;
|
this.startCoord = null;
|
||||||
@ -97,7 +102,7 @@ export class TapClick {
|
|||||||
if (!this.startCoord) {
|
if (!this.startCoord) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.activator) {
|
if (this.activator && ev.target !== this.plt.doc()) {
|
||||||
let activatableEle = getActivatableTarget(ev.target);
|
let activatableEle = getActivatableTarget(ev.target);
|
||||||
if (activatableEle) {
|
if (activatableEle) {
|
||||||
this.activator.upAction(ev, activatableEle, this.startCoord);
|
this.activator.upAction(ev, activatableEle, this.startCoord);
|
||||||
@ -133,7 +138,7 @@ export class TapClick {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.activator) {
|
if (this.activator && this.plt.doc() !== ev.target) {
|
||||||
// cool, a click is gonna happen, let's tell the activator
|
// cool, a click is gonna happen, let's tell the activator
|
||||||
// so the element can get the given "active" style
|
// so the element can get the given "active" style
|
||||||
const activatableEle = getActivatableTarget(ev.target);
|
const activatableEle = getActivatableTarget(ev.target);
|
||||||
@ -235,7 +240,7 @@ export const isActivatable = function (ele: HTMLElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0, l = ACTIVATABLE_ATTRIBUTES.length; i < l; i++) {
|
for (let i = 0, l = ACTIVATABLE_ATTRIBUTES.length; i < l; i++) {
|
||||||
if (ele.hasAttribute(ACTIVATABLE_ATTRIBUTES[i])) {
|
if (ele.hasAttribute && ele.hasAttribute(ACTIVATABLE_ATTRIBUTES[i])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,11 @@ describe('TapClick', () => {
|
|||||||
expect( isActivatable(ele) ).toBe(true);
|
expect( isActivatable(ele) ).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be not activatable on element without "hasAttribute" function', () => {
|
||||||
|
let doc = document.createDocumentFragment();
|
||||||
|
expect( isActivatable(<any>doc) ).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user