Re: Object identity

All - please send feedback on Matt's questions i.e should the spec say 
something here and if so, what should it say?

Matt - is there some related work or precedences we can 
use/leverage/consider?

(Note to reader: the examples below reflect earlier versions of the spec 
so if you are referencing the latest spec, you need to 
s/identifiedPoint/identifiedTouches/).

On Apr/26/2011 1:39 PM, ext Matt Brubeck wrote:
> Should the Touch Events standard specify whether certain operations 
> return the same object?
>
>
> Example 1: Should changedTouches and targetTouches refer to the same 
> objects as the "touches" attribute for the same event?
>
> window.addEventListener("touchstart", function(e) {
>   var changedTouch = e.changedTouches[0];
>   var id = changedTouch.identifier;
>
>   var touch       = e.touches.identifiedPoint(id);
>   var targetTouch = e.targetTouches.identifiedPoint(id);
>
>   // Should these be true?
>   assert(touch == changedTouch);
>   assert(touch == targetTouch);
> });
>
>
> Example 2: Should different touch events refer to the same objects?
>
> window.addEventListener("touchstart", function(e0) {
>   var touch0 = e0.touches[0];
>   var id = touch.identifier;
>
>   window.addEventListener("touchmove", function(e1) {
>     var touch1 = e1.touches.identifiedPoint(id);
>     assert(touch0 == touch1); // Should this be true?
>   });
> });
>
>
> Leaving these implementation-defined might lead to content depending 
> on one behavior, and breaking if the implementation changes.  For a 
> similar example, see:
> http://www.quirksmode.org/blog/archives/2010/02/persistent_touc.html
>

Received on Thursday, 5 May 2011 12:21:41 UTC