- From: Anders Höckersten <andersh@opera.com>
- Date: Tue, 20 Sep 2011 10:35:17 +0200
- To: public-webevents@w3.org
On Wed, 07 Sep 2011 22:07:06 +0200, <Cathy.Chan@nokia.com> wrote: > I have a couple of questions regarding event targets with reference to > our v1 > spec at http://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html. > > 1. In the definition of the touchend event (Section 5.5), > [[ The target of this event must be the same Element that received the > touchstart event when this touch point was placed on the surface, even > if the > touch point has since moved outside the interactive area of the target > element.]] > > Does this mean that an element always has to register also for touchstart > events in order to receive touchend events? In other words, if, for > whatever > reason, an element registers only for touchend events and not touchstart > events, will it receive any events? Note that this is how the example in > Section 5.3.2 is set up. > > Ditto for the touchmove event (Section 5.6). > > 2. What is the target of the touchcancel event? What are targetTouches > and > changedTouches for this event? I would assume they are the same as in the > case of the touchend event. > > Thanks. > > Regards, Cathy. > Hi, Just found my note from the last meeting where I said I would respond to (1). If you recall, I expressed some concern that supporting touchend without first receiving touchstart might pose a problem for implementations. I have now tested this in: - Opera Mobile (recent internal build) - the default Android browser (cyanogenmod 7/android 2.3) - Firefox Mobile beta 7.0 (build downloaded from android market today) All of them currently implement sending touchend events even if no touchstart or touchmove listener was registered. Whether or not it is useful to support this is a discussion that might be worth having, but it doesn't seem to pose any problem for any of these implementations, at least. That also means the answer to Cathy's question, at least as it is implemented in browsers currently, is that no, you don't have to register for touchstart events in order to receive touchend events. Here's the test I wrote for it, btw. If it is needed for the test suite or similar feel free to use it. <!DOCTYPE html> <html> <head> <script> document.addEventListener('touchend', handleEvent, false); function handleEvent(e) { document.getElementById('result').textContent = 'touchend received'; } </script> </head> <body> <p>Touch somewhere on the page</p> <p id="result"></p> </body> </html> /A
Received on Tuesday, 20 September 2011 08:35:49 UTC