Why does =$0 appear in Safari web inspector?
I've been wondering about this for a while. Why does =$0
appears next to elements in the web inspector in Safari? I am using Safari 9.0.1
Here is a picture of what I'm talking about
(larger):
Or if you prefer the version to read:
<div style="height: 100px; width: 2px; background-color: rgb(255,196,122); transform: rotate(-60deg); bottom: 10px; right: 80x;"> = $0
More than likely, you've used the Inspection Tool and have an element highlighted.
The $0–$4 variables contain the current and previous selected nodes from the Elements Tree Hierarchy.
source: https://webkit.org/blog/829/web-inspector-updates/
Chrome, Firefox, Opera, Safari - If you have an element currently selected in your "Elements" tab, you can use the reference $0 to call it within your code. For example, to see the elements' contents you would type $0.innerHTML. In Chrome and Safari, you can call the console from any of the other tabs by pressing "Escape" so you don't have to keep switching.
source: http://www.andismith.com/blog/2011/11/25-dev-tool-secrets/
$0 - $4 The $0, $1, $2, $3 and $4 commands work as a historical reference to the last five DOM elements inspected within the Elements panel or the last five JavaScript heap objects selected in the Profiles panel. $0 returns the most recently selected element or JavaScript object, $1 returns the second most recently selected one, and so on.