I'm developing an extension, which need to catch middle click events on
all input elements.
I know I need to add event listeners. Do I have to add the listeners
manually on every input element each time a new document is loaded? But
window.addEventListener("load", ...) seems to work only when Firefox is
started, it doen't work for new pages. Could anyone guide me how to do this?
Thanks,
Ryan Li
Look up "capturing" for event listeners. Be patient, the explanations
are confusing. But the short version is that you can add an listener to
the top of the tree (document) which is "capturing" and get the event
first. So a capturing event listener for click events, checking on the
target and click type.
Yes, you have to add the listeners manually on every new document. I
wonder if 'jetpack' makes this any easier?
jjb