Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Commit b684991

Browse files
committed
Define navigator.maxTouchPoints as 0 when unknown
Fixes gh-332 Closes gh-335
1 parent d1aa08d commit b684991

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Touches will not generate events unless inside of an area that has a valid `touc
102102

103103
## navigator.maxTouchPoints
104104

105-
As the information necessary to populate [`navigator.maxTouchPoints`](https://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface) is not available in browsers that do not natively implement pointer events, PEP does not currently polyfill this extension to the `navigator` interface.
105+
As the information necessary to populate [`navigator.maxTouchPoints`](https://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface) is not available in browsers that do not natively implement pointer events, PEP sets the value to `0`, which is "the minimum number guaranteed to be recognized" as required by the specification.
106106

107107
### Browser Compatibility
108108

src/platform-events.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export function applyPolyfill() {
1818
});
1919
dispatcher.registerSource('ms', msEvents);
2020
} else {
21+
Object.defineProperty(window.navigator, 'maxTouchPoints', {
22+
value: 0,
23+
enumerable: true
24+
});
2125
dispatcher.registerSource('mouse', mouseEvents);
2226
if (window.ontouchstart !== undefined) {
2327
dispatcher.registerSource('touch', touchEvents);

0 commit comments

Comments
 (0)