RESOLVED FIXED Bug 147740
TouchEvent and Touch should have constructors
https://bugs.webkit.org/show_bug.cgi?id=147740
Summary TouchEvent and Touch should have constructors
Rick Byers
Reported 2015-08-06 12:14:55 PDT
Most UIEvents at this point have a DOM Event constructor. TouchEvent is a notable exception. It's not a big use case, but JS-generated events are sometimes useful and (IMHO) ideally all event types would be consistent in this regard. Is there any interest in adding constructors to WebKit? Should be trivial. We (Touch Event Community Group) have recently added constructor definitions to the draft TouchEvents level 2 spec: http://w3c.github.io/touch-events/touchevents.html#touchevent-interface (bug: https://github.com/w3c/touch-events/issues/10). Any feedback on the design? I'm happy to make changes before pages start depending on the API. http://crbug.com/508675 tracks shipping these in blink.
Attachments
Rick Byers
Comment 1 2015-11-09 22:16:13 PST
Beth, is this little tweak something you hope to do at some point?
Beth Dakin
Comment 2 2015-11-09 23:07:11 PST
(In reply to comment #1) > Beth, is this little tweak something you hope to do at some point? Thanks for cc'ing me! Could be interesting. :-)
Radar WebKit Bug Importer
Comment 3 2016-05-03 08:04:55 PDT
Rick Byers
Comment 4 2016-06-14 14:03:30 PDT
/cc grouts who seems to be doing other TouchEvents works (yay!)
Chris Dumez
Comment 5 2016-06-17 12:06:06 PDT
I am working on the TouchEvent constructor.
Chris Dumez
Comment 6 2016-06-17 14:34:11 PDT
Added a TouchEvent constructor via Bug 158883. It looks like WebKit on iOS already has a constructor for Touch so closing.
Rick Byers
Comment 7 2016-09-26 12:01:48 PDT
Chris, does the Touch constructor on iOS follow the spec (and normal DOM constructor pattern) in taking a dictionary? foolip@ says he can only get it working by passing a list of parameters similar to createTouch.
Rick Byers
Comment 8 2016-09-26 12:02:54 PDT
Chris Dumez
Comment 9 2016-09-26 12:06:08 PDT
(In reply to comment #7) > Chris, does the Touch constructor on iOS follow the spec (and normal DOM > constructor pattern) in taking a dictionary? foolip@ says he can only get > it working by passing a list of parameters similar to createTouch. It does not look like we support passing a Dictionary at the moment, it takes in a list of parameters :/
Rick Byers
Comment 10 2016-09-26 12:24:33 PDT
> It does not look like we support passing a Dictionary at the moment, it takes in a list of parameters :/ Ugh, yeah that's not going to be interoperable (the whole point of the constructors is to avoid having to keep extending a long argument list). Ok if we reopen this to track getting WebKit passing this test? https://github.com/w3c/web-platform-tests/blob/master/touch-events/touch-touchevent-constructor.html
Rick Byers
Comment 11 2016-09-28 11:26:00 PDT
Note that if issue 157269 isn't going to be fixed, than the Safari-specific TouchEvent constructor should probably also have a way to set these non-standard properties on TouchEvent. I have now come across one script that is relying on these properties on Safari: http://s0.2mdn.net/instream/video/client.js, and as a result other libraries cannot move from initTouchEvent to the TouchEvent constructor without breaking this script.
Rick Byers
Comment 12 2016-09-28 11:26:47 PDT
Darn sorry, used the wrong hotword. See "bug 15726" for the clientX/clientY issue above.
Rick Byers
Comment 13 2016-09-28 11:27:24 PDT
Damn damn, not my day :-) See "bug 157269" for the clientX/clientY issue above.
Chris Dumez
Comment 14 2016-10-04 08:57:53 PDT
Resolved in sub-bugs.
Note You need to log in before you can comment on or make changes to this bug.