MozillaZine

DOM Inspector

From MozillaZine Knowledge Base

The DOM Inspector is a Mozilla tool used to inspect, browse, and edit the Document Object Model of documents - usually web pages or XUL windows.

Contents

Available documentation

The article "Introduction to the DOM Inspector" provides a basic overview of the DOMi. It's a good place to orient yourself with the DOMi and learn how to use its features. The article has some Mozilla Suite-specific references, but most of the information still applies to DOMi in Firefox and other programs.

Mozilla.org's DOM Inspector FAQ has some additional information. The "Creating Applications with Mozilla" book hosted at mozdev.org also has a section about the DOMi.

Getting the DOMi

Firefox

Firefox 2 and earlier: The DOMi is included in builds since November 2003, as an option in the Windows installer. You must choose the "Custom" installation and select "DOM Inspector" in the "Choose Optional Components" window (see Installing Firefox on Windows for details). In at least some versions of Linux—Ubuntu for one—the DOMi is a separate package.

Starting in Firefox 3: The DOM Inspector is no longer included with Firefox but it is available as an extension.

Thunderbird

DOMi was an installer option in Thunderbird builds since the end of March 2004 and in the 0.6 release, but it was removed from installer for the 0.8 release to keep download size small. It is now available as an extension—make sure you choose the right extension for your platform. (See bug 254031 for progress on an “official” extension.)

The bottom of the web page has a link to older releases of the extension.

Mozilla Suite and SeaMonkey

The DOM Inspector is available in the "Complete" Mozilla Suite and SeaMonkey installation or by selecting the Inspector component in a "Custom" installation.

Nvu

There is an Nvu version of the DOMi.

Related Extensions

Additionally, the Inspector Widget extension adds an "Inspect" toolbar button and the menu option "Tools -> Web Development -> DOM Inspector". Selecting an element after clicking the Inspect button will launch the DOMi and inspect the element.

If you wish to use XPath for DOM tree navigation, or query the document by XPaths and RegExp in the DOMi you may find useful the XPather extension (XPather Homepage).

Element Capture adds a Capture button to the DOMi window to take a screenshot of a selected element.

For more related extensions, search for DOM Inspector on Mozilla Add-ons site.

Using the DOMi

The DOM Inspector is very handy tool for theme and extension developers, as it allows you to view various properties associated with any XUL element.

  • Browse the tree structure of interface elements
  • View an element's Box Model properties like border and padding
  • Find element names, IDs, and classes to select elements in CSS
  • Find out what files (CSS, images) are used to style an element
  • See what properties and methods of given element you can call from your JavaScript

This section is a stub.

Issues with the DOMi

Warning! Changing themes while using the DOMi may cause the program to crash.

NOTE There is a problem with the Inspector if "Show Whitespace Nodes" is not selected - > the "Blink Selected Element" option is turned off when the Inspector is opened. It does not store the preferences... There is a bug (307255) and a proposed "fix" at this location:

http://bonsaibugs.org/

It seems to address the old Inspector that came as an extension, so no work around for now (?).