- From: Rick Byers via GitHub <sysbot+gh@w3.org>
- Date: Wed, 22 Jun 2016 16:14:00 +0000
- To: public-pointer-events@w3.org
RByers has just created a new issue for
https://github.com/w3c/pointerevents:
== Add feature detection section ==
Discussed on the call today that we should add a non-normative section
about suggested feature detection. Perhaps something like this?
```javascript
if (window.PointerEvent) {
// Listen only for pointer events when they're supported.
// Don't bother listening for mouse/touch as they're redundant and
will only cause confusion.
target.addEventListener("pointerdown", ondown);
...
} else {
// Listen for both touch and (non-touch-derived) mouse events. No
need for feature detection.
target.addEventListener("touchstart", ondown);
target.addEventListener("mousedown", function(e) {
if (!e.sourceCapabilities ||
!e.sourceCapabilities.firesTouchEvents)
ondown(e);
});
...
}
````
@patrickhlauke says he'll write up a PR to discuss further.
Please view or discuss this issue at
https://github.com/w3c/pointerevents/issues/94 using your GitHub
account
Received on Wednesday, 22 June 2016 16:14:03 UTC