Use the Inspector API

Firefox add-ons may access the following objects from the chrome://browser/content/devtools/inspector/inspector.xul context:

window.inspector

defined in inspector-panel.js. Attributes and functions:

  • .selection - information about the inspector's selection:
    • .isNode() - returns true if selection is node.
    • .node - returns the actual element from the page
    • .window - the window object of the frame the selection is in.
  • .markDirty() - marks that the page has been changed by the inspector - a warning will be shown when leaving the page, since changes made through the inspector are rewritten on reload.

Bindable events using on:

markuploaded

Called when the left panel has been refreshed, after page change.

ready

Called on first markuploaded.

pseudoclass

Called after toggle of a pseudoclass.

layout-change

"low-priority change event for things like paint and resize."