Takes legacy inline JS (i.e. `onclick` and `href="javascript:..."` and creates an event handler to be run before the inlined code.