Difference between revisions of "Command Line API"
(Recovered Paul's changes to monitorEvents())
m (Added 'table' command)
|Line 78:||Line 78:|
=== profileEnd() ===
=== profileEnd() ===
Revision as of 05:17, 21 June 2012
The Firebug Command Line provides these special functions for your convenience:
- 1 $(id)
- 2 $$(selector)
- 3 $x(xpath)
- 4 $0
- 5 $1
- 6 $n(index)
- 7 dir(object)
- 8 dirxml(node)
- 9 cd(window)
- 10 clear()
- 11 inspect(object[, tabName])
- 12 keys(object)
- 13 values(object)
- 14 debug(fn)
- 15 undebug(fn)
- 16 monitor(fn)
- 17 unmonitor(fn)
- 18 monitorEvents(object[, types])
- 19 unmonitorEvents(object[, types])
- 20 profile([title])
- 21 profileEnd()
- 22 table(data[, columns])
Returns a single element with the given id.
Returns an array of elements that match the given CSS selector.
Returns an array of elements that match the given XPath expression.
The currently-selected object in the inspector.
The previously-selected object in the inspector.
Access to an array of last 5 inspected elements.
Prints an interactive listing of all properties of the object. This looks identical to the view that you would see in the DOM tab.
Prints the XML source tree of an HTML or XML element. This looks identical to the view that you would see in the HTML tab. You can click on any node to inspect it in the HTML tab.
By default, command line expressions are relative to the top-level window of the page. cd() allows you to use the window of a frame in the page instead.
Clears the console.
Inspects an object in the most suitable tab, or the tab identified by the optional argument
The available tab names are "html", "css", "script", and "dom".
Returns an array containing the names of all properties of the object.
Returns an array containing the values of all properties of the object.
Adds a breakpoint on the first line of a function.
Removes the breakpoint on the first line of a function.
Turns on logging for all calls to a function.
Turns off logging for all calls to a function.
Turns on logging for all events dispatched to an object. The optional argument
types may specify a specific family of events to log. The most commonly used values for
types are "mouse" and "key".
"composition", "contextmenu", "drag", "focus", "form", "key", "load", "mouse", "mutation", "paint", "scroll", "text", "ui", and "xul".
mouseto monitor all mousedown, mouseup, click, dblclick, mousemove, mouseover, mouseout, mousewheel events
keyto monitor all keydown, keyup, keypress, textInput events
touchto monitor all touchstart, touchmove, touchend, touchcancel events.
controlto monitor all resize, scroll, zoom, focus, blur, select, change, submit, reset events.
- an undefined types argument will monitor all of the above plus load, unload, abort, error, select, change, submit, reset, focus, blur, resize, scroll, search, devicemotion, deviceorientation events.
Turns off logging for all events dispatched to an object.
title would contain the text to be printed in the header of the profile report.
This is a shortcut for