element.removeEventListener
because we do not have a reference to the handler, while in the second case, it's possible to do myElement.removeEventListener("click", processEvent, false)
.
If true
, useCapture
indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered listener
before being dispatched to any EventTarget
beneath it in the DOM tree. Events which are bubbling upward through the tree will not trigger a listener designated to use capture. See DOM Level 3 Events for a detailed explanation. If not specified, useCapture
defaults to false
. Note: For event listeners attached to the event target; the event is in the target phase, rather than capturing and bubbling phases. Events in the target phase will trigger all listeners on an element regardless of the useCapture
parameter.
Note: useCapture
became optional only in more recent versions of the major browsers; for example, it was not optional prior to Firefox 6. You should provide this parameter for broadest compatibility.
wantsUntrusted
true
, the listener will receive synthetic events dispatched by web content (the default is false
for chrome and true
for regular web pages). This parameter is only available in Gecko and is mainly useful for the code in add-ons and the browser itself. See Interaction between privileged and non-privileged pages for an example.