Re: [w3c/touch-events] note about avoiding conditional "touch OR mouse/keyboard" event handling (#72)

> +if ('ontouchstart' in window) {
> +  // set up event listeners for touch
> +  target.addEventListener('touchend', ...);
> +  ...
> +} else {
> +  // set up event listeners for mouse/keyboard
> +  target.addEventListener('click', ...);
> +  ...
> +}
> +</code></pre>
> +      <p>Instead, developers should handle different forms of input concurrently.</p>
> +<pre class="example"><code>
> +// concurrent "touch AND mouse/keyboard" event binding
> +
> +// set up event listeners for touch
> +target.addEventListener('touchend', ...);

Thanks looks good!  Support for InputDeviceCapabilities is only Chrome at the moment, so this is probably the better choice in most situations.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/touch-events/pull/72/files/bb89c1d502b1a094e2e3b1883a84d7978094088c#r73263703

Received on Wednesday, 3 August 2016 00:48:57 UTC