TouchList

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The TouchList interface represents a list of contact points on a touch surface. For example, if the user has three fingers on the touch surface (such as a screen or trackpad), the corresponding TouchList object would have one Touch object for each finger, for a total of three entries.

This interface was an attempt to create an unmodifiable list and only continues to be supported to not break code that's already using it. Modern APIs represent list structures using types based on JavaScript arrays, thus making many array methods available, and at the same time imposing additional semantics on their usage (such as making their items read-only).

These historical reasons do not mean that you as a developer should avoid TouchList. You don't create TouchList objects yourself, but you get them from APIs such as TouchEvent.targetTouches, and these APIs are not deprecated. However, be careful of the semantic differences from a real array.

Instance properties

TouchList.length Read only

The number of Touch objects in the TouchList.

Instance methods

TouchList.item()

Returns the Touch object at the specified index in the list.

Example

Specifications

Specification
Touch Events
# touchlist-interface

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
TouchList
item
length

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Has more compatibility info.

See also