Re: [whatwg/dom] document.createEvent() should maybe not be conditional upon exposure (#952)

Mobile Safari does indeed expose TouchEvent. My understanding is that desktop Safari never supports touch (is compiled without support). I created a test page https://output.jsbin.com/pipudek which tests a few means of detecting touch support.

| Test | Chrome Desktop | Firefox Desktop | Safari Desktop | Chrome Mobile | Firefox Mobile | Safari Mobile |
| ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| 'TouchEvent' in window| true | false / true* | false | true | true | true |
| document.createEvent('touchevent') | throws | throws | throws | object | object | object |
| typeof(TouchEvent) | function | undefined / function* | undefined | function | function | function |
| 'ontouchstart' in window | false | false | false | true | true | true |

\* Depends if local device supports touch

Is the proposal is to not expose TouchEvent, but still dispatch TouchEvents to touch event handlers? I worry existing sites may be using UA detection to decide whether to include references to TouchEvent, which would then turn into errors if we were to do this.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/952#issuecomment-795606444

Received on Wednesday, 10 March 2021 15:30:01 UTC