The Inspector of Firefox can list all event listeners attached to specific DOM node from Firefox 33.
Example page:
<!doctype html>
<body>
<button id="Btn">Test</button>
<script>
function TestEventListener(e){
console.log("handle event");
}
var btn = document.querySelector("#Btn");
if(btn){
btn.addEventListener("click",TestEventListener,false);
}
</script>
</body>
</html>
Then press F12 and select Inspector, click on the small ev
tag aside the <button>
.
- How did Firefox do that?
- Did Firefox modified
addEventListener
from the beginning? Can this be done with native Javascript?
Like this:
function GetDOMEventList(node){ var listenerFunctionsList = []; [Magic Moves] return listenerFunctionsList; // [func1, func2, func3...] }