I'm writing a Chrome extension to list out the source code for each event handler attached to an <a/>
tag when you roll over it.
Currently, I've printed out the href attribute - $(this).attr("href")
- and this works fine. The source code is on github at http://github.com/grantyb/Google-Chrome-Link-URL-Extension.
When I extend it to access event handlers, $(this).data("events") returns null. I'm certain that there is a click() handler for my <a/>
tag, because when I output $("a").data("events")
inside my web page, it correctly lists the handler.
It seems that jQuery's data()
method is checking data that is sandboxed, so I can't access it from inside my Extension. That makes sense, since I guess it's stored within the jQuery
global variable, and that's clearly a different variable from the jQuery
global that lives inside my Extension.
Is there another way to access the list of event handlers for an object in the DOM. Are event handlers even stored in the DOM?