The Command Line API contains a collection of convenience functions for performing common tasks: selecting and inspecting DOM elements, displaying data in readable format, stopping and starting the profiler, and monitoring DOM events.
|
$0 - $4
|
$0 returns the most recently selected element or JavaScript object, $1 returns the second most recently selected one, and so on
|
$1
|
|
$(selector)
|
returns the reference to the first DOM element with the specified CSS selector
|
$('img')
|
|
$$(selector)
|
returns an array of elements that match the given CSS selector
|
$$('img')
|
|
$x(path)
|
returns an array of DOM elements that match the given XPath expression
|
$x('//p[a]')
|
|
monitorEvents(object[, events])
|
logs to the console when one of the specified events occurs on the specified object
|
monitorEvents(window, "resize")
|
|
unmonitorEvents(object[, events])
|
stops monitoring events for the specified object and events
|
monitorEvents(window)
|
|
debug(function)
|
invokes debugger and breaks inside the function
|
debug(loginUser)
|
|
keys(object)
|
returns an array containing the names of the properties belonging to the specified object
|
keys(user)
|
|
monitor(function)
|
logs a message to the console that indicates the function name along with the arguments that are passed
|
monitor(loginUser)
|
|
profile([name])
|
starts a JavaScript CPU profiling session with an optional name
|
profile('User Login')
|
|
profileEnd([name])
|
stops a JavaScript CPU profiling session with an optional name
|
profileEnd('User Login')
|
|
table(data[, columns])
|
logs object data with table formatting by passing in a data object in with optional column headings
|
table(user)
|
|
undebug(function)
|
stops the debugging of the specified function
|
undebug(loginUser)
|
|
unmonitor(function)
|
stops the monitoring of the specified function
|
unmonitor(loginUser)
|
|
values(object)
|
returns an array containing the values of all properties belonging to the specified object
|
values(user)
|
|
$_
|
returns the value of the most recently evaluated expression
|
$_
|
|
clear()
|
clears the console of its history
|
clear()
|
|
copy(object)
|
copies a string representation of the specified object to the clipboard
|
copy($0)
|
|
dir(object)
|
displays an object-style listing of all the specified object’s properties
|
dir($0), dir(myObject)
|
|
dirxml(object)
|
prints an XML representation of the specified object, as seen in the Elements tab
|
dirxml($0), dirxml(myObject)
|
|
inspect(object/function)
|
opens and selects the specified element or object in the appropriate panel
|
inspect(document.body)
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.