enyojs/enyo — pull request #949 by aarontam (2014-12-04 01:13:02+00:00)
Title: ENYO-573: Synchronize up/down events based on button.

### Issue
There can be situations where a mouse button is pressed down, and another mouse button is pressed down (a two-finger tap in an Android WebView, or using a multi-button mouse). When releasing one of the mouse buttons, `downEvent` is dereferenced, so when the remaining down-pressed mouse button is released, we are attempting to access a property of a `null` object. Additionally, when interacting with select controls, with the select control displaying its options list, a mouse button press outside of this list only generates a `mouseup` event and not a `mousedown` event, resulting in the same symptom. Please refer to http://www.quirksmode.org/dom/events/click.html, specifically the "On form fields and links" section.

### Fix
We could guard against a falsy `downEvent` object, but I wanted to also synchronize the up/down events when possible, by examining the `which` property of the event. This is pertinent when using a mouse with distinct buttons, where now the tap prevention property properly propagates (check out that alliteration) from the `mousedown` event to its corresponding `mouseup` event. In the case of Android's WebView, each tap registers as the same button, so effectively the fix just guards against a dereferenced `downEvent` before accessing its properties, as `downEvent` is referenced each time we handle `mouseup`. If this change seems too risky or unnecessary, we can just tweak the PR and only add the guard code.

Enyo-DCO-1.1-Signed-off-by: Aaron Tam