ibm-js / dpointer

AMD based API which follows W3C Pointer Events specification and adds click/dbl click normalization.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature detection broken for embedded C# WebBrowser Control

wkeese opened this issue · comments

Similar to the discussion in dojo/dojo@17ed3d6#commitcomment-14347450, dpointer's feature detection for pointer-events and mspointer-events presumably doesn't work for embedded C# WebBrowser Controls, where pointer support can "exist" but not be "enabled".

I ended up changing the dojo code to:

// Test if pointer events are supported and enabled, with either standard names ("pointerdown" etc.) or
// IE specific names ("MSPointerDown" etc.).  Tests are designed to work on embedded C# WebBrowser Controls
// in addition to IE, Edge, and future versions of Firefox and Chrome.
// Note that on IE11, has("pointer-events") and has("MSPointer") are both true.
has.add("pointer-events", "pointerEnabled" in window.navigator ?
        window.navigator.pointerEnabled : "PointerEvent" in window);
has.add("MSPointer", window.navigator.msPointerEnabled);

(You can check the latest version of dojo/has.js to see if I needed to change it again, after writing this ticket.)

Also incidentally, the parentheses should be removed from this regex, since they aren't needed and slow it down:

has.add("touch-device", /(mobile)|(android)/i.test ...