With JavaScript, how can I get a string representation of a DOM node similar to what the Chrome and WebKit inspectors display?
tag#id.class1.class2
A real example would look something like these:
div#top-menu.feature.active
li.#callout.product
The desired strings might be query selectors, but I haven't found a native way of extracting them. These don't need to be absolutely precise CSS selectors either (no nth-child
, etc.), just an identifying query string.