Re: [touch-events] TouchEvent constructor is very unusual since it converts one type of object (sequence) to another type (TouchList)

I wouldn't want to say it's necessarily too late to remove 
`sequence<Touch>` from `TouchEventInitDict`.  We could certainly try 
(eg. support both, flip our guidance, measure usage of the current 
approach and remove once usage is low enough).  My guess is that this 
is new enough that we could probably pull it off, but we'd need good 
justification for doing so.

To me, from a web dev perspective that design seems strictly worse.  
They don't think about `TouchList` when using touch events.  To a JS 
web dev, they feed in arrays and get something that they treat like an
 array out.  So forcing them to create a weird `TouchList` thing as an
 extra layer around their array seems like a net loss for the 
developer.

I looked for precedent elsewhere and found [one example of something 
similar](https://notifications.spec.whatwg.org/#dom-notificationoptions-actions)
 in the notifications spec.  There they use a 
`sequence<NotificationAction>` for input and a 
`FrozenArray<NotificationAction>` for output.

It would probably be compatible to replace `TouchList` with 
`FrozenArray<Touch>` in `TouchEvent`, right?  Of course we'd have to 
keep `TouchList` around for anyone using `createTouchList`, but we 
could deprecate it.

-- 
GitHub Notification of comment by RByers
Please view or discuss this issue at 
https://github.com/w3c/touch-events/issues/54#issuecomment-166749309 
using your GitHub account

Received on Tuesday, 22 December 2015 22:22:51 UTC