DOM-triggered events versus .trigger()

DOM-triggered events versus .trigger()


I was looking at this ticket and just attached a test case:
http://dev.jquery.com/ticket/3827
In the test, you can uncomment the lines to have the handlers return
false and prevent the default action, which would be to toggle the
checkbox state.
In jQuery, trigger() calls the handler before the default action is
taken. The check box is in its previous state, the one before the
click. If the handler returns false and/or uses preventDefault, jQuery
will not call the DOM element's click() method. Otherwise it calls the
click method and the default action occurs. (Also, handlers attached
via a native onclick property are only called in this case.)
In native DOM, the handler appears to be called *after* the default
action has already been taken. Returning false and/or using
preventDefault seems to reverse the default action; I could even see
the checkbox appear briefly in some cases.
You can get the native DOM behavior for a click in jQuery by using '''$
("#btn")[0].click()''' rather than '''$("#btn").click()''' or '''$
("#btn")[0].trigger("click")'''.
So I think the issue boils down to: If there is a native DOM method
for a particular element (click, change, etc.) should .trigger() use
that to invoke the handlers, rather than calling the handlers and then
only calling the native DOM method if the handlers did not return
false? (There may be bubbling issues with that on some event types,
I'm not sure.) Or, should the wiki just document the fact that
manually triggered versions of native events happen at a different
time?