see eg http://davidwalsh.name/event-delegate

except we have https://developer.mozilla.org/en-US/docs/DOM/Element.mozMatchesSelector in gecko which makes it easier to use