W3C home > Mailing lists > Public > public-webevents@w3.org > April to June 2011

Object identity

From: Matt Brubeck <mbrubeck@mozilla.com>
Date: Tue, 26 Apr 2011 10:39:08 -0700
Message-ID: <4DB7033C.50008@mozilla.com>
To: "public-webevents@w3.org" <public-webevents@w3.org>
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 Tuesday, 26 April 2011 17:39:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 26 April 2011 17:39:39 GMT