TouchEvent: targetTouches property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
ThetargetTouches read-only property is aTouchList listing all theTouch objects for touch points that are still in contact with the touch surfaceand whosetouchstart event occurred inside the same targetelement as the current target element.
In this article
Value
ATouchList listing all theTouch objects for touch points that are still in contact with the touch surfaceand whosetouchstart event occurred inside the same targetelement as the current target element.
Examples
This example illustrates theTouchEvent object'sTouchEvent.targetTouches property. TheTouchEvent.targetTouches property is aTouchList object that includes those TPs that are currently touching the surfaceand started on the element that is the target of the current event. As such, thetargetTouches list is a strict subset of thetouches list.
In following code snippet, the function compares the length of thetouches list to the length of thetargetTouches list and returnstrue if the lengths are the same and returnsfalse otherwise.
function touchesInTarget(ev) { // Return true if all of the touches are within the target element; // otherwise return false. return ev.touches.length === ev.targetTouches.length;}Specifications
| Specification |
|---|
| Touch Events> # dom-touchevent-targettouches> |