Difference between revisions of "Inspect"

From FirebugWiki
Jump to: navigation, search
(Separate Command Line API page for inspect())
 
m (Added categories)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Inspects an object in the most suitable panel, or the panel identified by the optional argument <code>panelName</code>.
 
Inspects an object in the most suitable panel, or the panel identified by the optional argument <code>panelName</code>.
  
The available panel names are "html", "stylesheet", "script", and "dom".
+
== Syntax ==
 +
<source lang="javascript">
 +
inspect(object[, panelName])
 +
</source>
 +
 
 +
== Parameters ==
 +
=== object ===
 +
The object to inspect. '''(required)'''
 +
 
 +
=== panelName ===
 +
Name of the panel to inspect the object in. (optional)
 +
 
 +
The available panel names integrated into Firebug are <code>html</code>, <code>stylesheet</code>, <code>script</code>, <code>dom</code>, <code>net</code> and <code>cookies</code>. (Though the [[Net Panel]] and the [[Cookies Panel]] currently don't support inspecting).
 +
 
 +
If the panel name is not given, the most appropriate panel will be chosen.
 +
 
 +
== Examples ==
 +
<source lang="javascript">
 +
inspect(document)
 +
</source>
 +
 
 +
Inspects the <code>document</code> property inside the [[DOM Panel]].
 +
 
 +
<source lang="javascript">
 +
inspect(document.body.firstElementChild)
 +
</source>
 +
 
 +
Inspects the first element child of the <code>&lt;body&gt;</code> tag inside the [[HTML Panel]].
 +
 
 +
<source lang="javascript">
 +
inspect(document.styleSheets[0].cssRules[9])
 +
</source>
 +
 
 +
Inspects the 10th rule of the first CSS stylesheet inside the [[CSS Panel]].
 +
 
 +
<source lang="javascript">
 +
inspect(myFunction, "script")
 +
</source>
 +
 
 +
Inspects the function <code>myFunction</code> inside the [[Script Panel]]. If the second parameter wouldn't be specified, the function would be inspected inside the [[DOM Panel]].
 +
 
 +
== See also ==
 +
* [[Command Line API]]
 +
 
 +
[[Category:Firebug]]
 +
[[Category:UI]]
 +
[[Category:API]]

Latest revision as of 16:04, 21 November 2013

Inspects an object in the most suitable panel, or the panel identified by the optional argument panelName.

Syntax[edit]

inspect(object[, panelName])

Parameters[edit]

object[edit]

The object to inspect. (required)

panelName[edit]

Name of the panel to inspect the object in. (optional)

The available panel names integrated into Firebug are html, stylesheet, script, dom, net and cookies. (Though the Net Panel and the Cookies Panel currently don't support inspecting).

If the panel name is not given, the most appropriate panel will be chosen.

Examples[edit]

inspect(document)

Inspects the document property inside the DOM Panel.

inspect(document.body.firstElementChild)

Inspects the first element child of the <body> tag inside the HTML Panel.

inspect(document.styleSheets[0].cssRules[9])

Inspects the 10th rule of the first CSS stylesheet inside the CSS Panel.

inspect(myFunction, "script")

Inspects the function myFunction inside the Script Panel. If the second parameter wouldn't be specified, the function would be inspected inside the DOM Panel.

See also[edit]