I would like to use chrome API (JavaScript) to create simple DOM inspector (you know the DOM inspector from Firefox developers tools where you can click over DOM element and it will display some information about the element). I am not using directly Chrome browser, but chrome API which is used by Firefox. I know how to bind event with element using addEventListener like this:
target.addEventListener(type, listener[, options]);
target.addEventListener(type, listener[, useCapture]);
target.addEventListener(type, listener[, useCapture, wantsUntrusted]); // Gecko
But the target in the code above is some specified element. My question is how to implement the idea when I don't know which element will be clicked. I mean, should I bind the listener to all DOM elements? Hopefully there is some better, easier and universal solution for this. I add the google-chrome API tag because I think the implementation in Firefox webextensions should be similar like in Chrome.