W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2011

Re: [DOM3Events] stop propagation and canceled flags

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 01 Mar 2011 21:01:04 +0100
To: "Anne van Kesteren" <annevk@opera.com>
Cc: www-dom@w3.org
Message-ID: <6iiqm6hpt4ln4oc7nnbcsnv5u6gev1r7pd@hive.bjoern.hoehrmann.de>
* Anne van Kesteren wrote:
>http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#event-flow  
>says "As the final step of the event dispatch, for reasons of backwards  
>compatibility, the implementation must reset the event object's  
>internal-propagation and default-action-prevention states."

This is the result of issues 20 and 35 in the former WebAPI Working
Group where you will find test cases and data and opinions on this.
I do note that in order to adequately test this you would also have
to check, say, implementation-generated events versus synthesized
ones, and modifying these states from within handlers rather than
before dispatching them the first time. Feel free to be inspired by
the member-only test code I submitted for these issues if they are
useful.

>As far as I can tell this is not implemented this way. Propagation is not  
>reset in either Opera or WebKit (it is in Gecko).

>So it appears that there is no backwards compatibility issue here.

Clearly if Firefox behaves in a certain way here then doing some-
thing else might break deployed code that works today in Firefox,
so it would seem there is indeed a compatibility issue there.

>Having said that, something to reset these flags might be nice so event  
>objects can be reused. Or do we always want people to create new event  
>objects? Maybe invoking initEvent() should reset these flags? As invoking  
>initEvent() can also change the nature of it being cancelable.

I would regard it as a bad practise to use the same event object
multiple times; semantically event objects are event instances,
and an instance of an event is unique. And you would be relying on
hidden state, which is unreliable, as you can see here. Do note
that these questions have also been discussed in the issues above,
at least as I recall them.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Tuesday, 1 March 2011 20:01:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:07 GMT