Re: [DOM3Events] stop propagation and canceled flags

* 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 UTC