2009/8/20 Tom Worster <f...@thefsb.org>:
>
> is there a way to set up a page so that a event handler function is bound to
> a DOM object and event but it runs _after_ the browser's default action is
> complete?
>

No; the DOM Events specifications explicitly state that the event
handling process occurs before the default action of the browser. For
example, DOM Level 2 Events section 1.2.4 [1] states:

"...the DOM implementation generally has a default action associated
with the event. An example of this is a hyperlink in a web browser.
When the user clicks on the hyperlink the default action is generally
to active that hyperlink. *Before processing these events*, the
implementation must check for event listeners registered to receive
the event and dispatch the event to those listeners. These listeners
then have the option of canceling the implementation's default action
or allowing the default action to proceed."

DOM Level 3 Events section 1.3 [2] is even more explicit:

"The default actions *are not part of the DOM Event flow*. Before
invoking a default action, the implementation must first dispatch the
event as described in the DOM event flow."

[my emphasis in both extracts]

So I'm afraid your out of luck on that :-(

[1] 
<http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-flow-cancelation>
[2] 
<http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-flow-cancelation>

(BTW, I'm curious as to why you would ever need to do this - I suspect
that if you state the actual problem you're trying to solve, rather
than the mechanism you thought might help you solve it, then somebody
can probably suggest a different approach which will "Just Work".)

Cheers,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/

Reply via email to