I’m trying to make an extension that unbinds a click event added by the website itself.
The website uses jQuery, which would make this insanely simple:
jQuery('a[rel]').unbind('click');
The problem is that my extension (using “content_scripts”) can’t access the website’s jQuery object and therefore doesn’t have the event functions to unbind. I can include a jQuery in my extension, but that wouldn’t help, because jQuery stores ‘data’ in the jQuery object (not in the DOM elements). My jQuery will not have those events stored.
Is there another way? It doesn’t have to be pretty. Maybe without “content_scripts”?
Just call
unbind_event_listeners(a_node)to unbind any listeners from a node. This will work on every node in the document exceptdocumentitself. As forwindow, you’re out of luck.unbind_event_listeners(document.documentElement)should remove most event listeners attached to nodes in the document.In the case of
a[rel], you’d want to do this: