W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

Cancellability and two-phase events

From: John Ky <hand@syd.speednet.com.au>
Date: Mon, 25 Sep 2000 19:38:32 +1000
Message-ID: <001801c026d4$5f31df00$d000a8c0@NEWHOGGY>
To: <www-dom@w3.org>
I believe there is an issue with cancellable events.

The problem here is that event listeners might be written
such that they are sensitive to whether the event it responds
to was cancelled or not.

It would be nice to be able to assume that I can write
an event listener with the certainty that:

1.  if my event listener gets executed, then the default
    action of the associated event gets executed.
2.  if my event listener gets executed, then it can perform
    tasks that are consistent with other event listeners on
    the same event target or later event targets.

At the moment my event listener can be executed while
a sibling calls preventDefault(); + stopPropagation();

I would much prefer that events where dispatched in
two phases.

Phase 0 - all events are cancellable
Phase 1 - no events are cancellable

That is, a cancellable event would only be dispatched in
phase 0 and a non-cancellable event would only be
dispached on phase 1.  All phase 0 dispatches are
performed before any phase 1 dispatches.  If the
any events are cancelled in phase 0, then the
phase 1 dispatched is not performed.

So when a event listener cancels an event in phase 0,
my event listener waiting on phase 1 can safely assume
it won't get called.

Thanks

-John
Received on Monday, 25 September 2000 04:39:21 GMT

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