Firebug: Accessing in the console an object you just “looked at” in the DOM Inspector

StackOverflow https://stackoverflow.com/questions/616301

  •  03-07-2019
  •  | 
  •  

Question

  1. You have a console.log(o) in your code.
  2. Now in Firebug you can click on the object in the console, which takes you to the DOM inspector.
  3. I thought there was a way to then access from the console command line that object you just inspected with $0, but it doesn't seem to work.

Maybe something changed in Firebug, or I don't remember this correctly. Is there another way to do this in Firebug? If not, do you have workaround to suggest?

Was it helpful?

Solution

This works again in Firebug 1.5: you can access the last active element you looked at in the HTML tab from the console with $0. This is extremely convenient.

OTHER TIPS

From the HTML view or DOM view you can get an XPath for the element inspected. You can then paste the XPath in this code to get it as a var:

var $0 = new XPathEvaluator().evaluate('my-xpath', document, new XPathEvaluator().createNSResolver(document), 0, null).iterateNext();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top