Inspect

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
(Separate Command Line API page for inspect())
(Added parameter description and examples)
(One intermediate revision 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]]

Revision as of 12:03, 13 July 2012

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

Contents

Syntax

inspect(object[, panelName])

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 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

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

Personal tools