Skip to content

Inspect Tool

Mike Rennie edited this page Aug 9, 2012 · 3 revisions

The Inspector tools notify clients of element inspections in Firebug. By default the Inspector tool is not enabled.

Clients can automatically turn on the inspector tool via a modified handshake.

inspect

Tells Firebug to enter 'inspect' mode on the given node. The form of the packet is:

Content-Length:<content_length>
\r\n\r\n
{
  "type":"request",
  "command":"inspect",
  "contextId":<context_id>,
  "seq":<packet_sequence>,
  "arguments":{
                "xpath":<xpath>
                "selector":<selector>
              }
}
\r\n

Arguments

content_length number
the entire length of the packet content between the curly braces (including the curly braces)
context_id string
the id of the context this request is targeted for
packet_sequence number
the packet sequence number
xpath optional, string
an *optional* argument specifying the xpath to the node to inspect.
selector optional, string
an *optional* argument specifying the selector of the node to inspect

One of xpath or selector must be specified. If both are specified, xpath is used.

Example Request

An example of the request you send:

Content-Length:128
\r\n\r\n
{
  "type":"request",
  "command":"inspect",
  "contextId":"xf0.3::815372",
  "seq":51,
  "arguments":{
                "xpath":"/html[1]/body[1]/span[1]"
              }
}
\r\n

Example Response

An example of the response you receive:

Content-Length:307
\r\n\r\n
{
  "type":"response",
  "command":"inspect",
  "seq":53,
  "request_seq":51,
  "body":{
           "xpath":"/html[1]/body[1]/span[1]",
          },
  "running":false,
  "success":true
}

onInspectNode

Fired when Firebug is in 'Inspect Mode' and DOM elements are inspected. The event contains the path to the DOM element being inspected at the time the even was fired.

Content-Length:186
\r\n\r\n
{
  "type":"event",
  "event":"onInspectNode",
  "contextId":"xf0.3::7640266",
  "seq":66,
  "data":{
           "node":"/html[1]/body[1]/div[1]/div[4]/div[1]/div[1]/div[2]/div[2]/div[7]/div[1]/span[2]/span[1]"
         }
}

Event Data

node string
the complete unique path to the element being inspected in the DOM.