Pointer Events
vs.
Touch Events
in Blink
Rick Byers - Nov 4, 2014
Problems
Why introduce pointer events?
Problems
Code sharing
| Lines of code | Delta |
Mouse only (single) | 60 | |
73 | 13 | |
131 | 71 | |
86 | 26 | |
89 | 29 |
Problems
if ('ontouchstart' in window)
element.addEventListener('touchstart', activate);
else
element.addEventListener('mousedown', activate);
JS
Problems
Problems
Pointer Events?
Are they a good fit for blink priorities?
Blink Priorities
Interoperability with Safari is critical
Touch events are the best hope for a single API
Easily adapting mouse code is no longer our goal
Blink Priorities
Performance
Richness
Rationality
Blink Priorities
Minor in practice - disadvantage in principle
2.5% frame hit-test penalty
Risk of double event dispatch
Evolving
Touch Events
Another way to address the problems
Evolving Touch Events
Evolving Touch Events
Evolving Touch Events
Evolving Touch Events
Evolving Touch Events
TouchEvent.pointerType
TouchEvent.buttons
touchhover
Element.setTouchCapture
...
Evolving Touch Events
Debate
What should we be doing differently?