Firebug:在控制台中访问您在DOM Inspector中“查看”的对象

时间:2020-12-08 20:43:17
  1. You have a console.log(o) in your code.
  2. 您的代码中有console.log(o)。

  3. Now in Firebug you can click on the object in the console, which takes you to the DOM inspector.
  4. 现在在Firebug中,您可以单击控制台中的对象,该对象将您带到DOM检查器。

  5. 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.
  6. 我认为有一种方法可以从控制台命令行访问您刚刚用$ 0检查的对象,但它似乎不起作用。

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?

也许在Firebug中有些变化,或者我没有记错。还有另一种方法可以在Firebug中执行此操作吗?如果没有,你有建议的解决方法吗?

2 个解决方案

#1


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.

这在Firebug 1.5中再次起作用:您可以从控制台以$ 0访问HTML选项卡中查看的最后一个活动元素。这非常方便。

#2


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:

从HTML视图或DOM视图中,您可以获得检查元素的XPath。然后,您可以在此代码中粘贴XPath以将其作为var:

var $0 = new XPathEvaluator().evaluate('my-xpath', document, new XPathEvaluator().createNSResolver(document), 0, null).iterateNext();

#1


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.

这在Firebug 1.5中再次起作用:您可以从控制台以$ 0访问HTML选项卡中查看的最后一个活动元素。这非常方便。

#2


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:

从HTML视图或DOM视图中,您可以获得检查元素的XPath。然后,您可以在此代码中粘贴XPath以将其作为var:

var $0 = new XPathEvaluator().evaluate('my-xpath', document, new XPathEvaluator().createNSResolver(document), 0, null).iterateNext();