Command Line API Reference Cheat Sheet

A Software › Chrome cheat sheet in English by nire0510

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.

10,517 views 3,352 downloads 25 Oct 2015 History
3.7 avg · 0 ratings

Elements

$0 - $4
$0 returns the most recently selected element or JavaScript object, $1 returns the second most recently selected one, and so on
$1
$(sele­ctor)
returns the reference to the first DOM element with the specified CSS selector
$('i­mg')
$$(sel­ector)
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]­')
monito­rEv­ent­s(o­bject[, events])
logs to the console when one of the specified events occurs on the specified object
monito­rEv­ent­s(w­indow, "­res­ize­")
unmoni­tor­Eve­nts­(ob­ject[, events])
stops monitoring events for the specified object and events
monito­rEv­ent­s(w­indow)

Functions / Code

debug(­fun­ction)
invokes debugger and breaks inside the function
debug(­log­inUser)
keys(o­bject)
returns an array containing the names of the properties belonging to the specified object
keys(user)
monito­r(f­unc­tion)
logs a message to the console that indicates the function name along with the arguments that are passed
monito­r(l­ogi­nUser)
profil­e([­name])
starts a JavaScript CPU profiling session with an optional name
profil­e('User Login')
profil­eEn­d([­name])
stops a JavaScript CPU profiling session with an optional name
profil­eEn­d('User Login')
table(­data[, columns])
logs object data with table formatting by passing in a data object in with optional column headings
table(­user)
undebu­g(f­unc­tion)
stops the debugging of the specified function
undebu­g(l­ogi­nUser)
unmoni­tor­(fu­nction)
stops the monitoring of the specified function
unmoni­tor­(lo­gin­User)
values­(ob­ject)
returns an array containing the values of all properties belonging to the specified object
values­(user)

Common

$_
returns the value of the most recently evaluated expression
$_
clear()
clears the console of its history
clear()
copy(o­bject)
copies a string repres­ent­ation of the specified object to the clipboard
copy($0)
dir(ob­ject)
displays an object­-style listing of all the specified object’s properties
dir($0), dir(my­Object)
dirxml­(ob­ject)
prints an XML repres­ent­ation of the specified object, as seen in the Elements tab
dirxml­($0), dirxml­(my­Object)
inspec­t(o­bje­ct/­fun­ction)
opens and selects the specified element or object in the approp­riate panel
inspec­t(d­ocu­men­t.body)

Badges

Nice Cheat Sheet Good Cheat Sheet Downloaded from Unusual Locations × 1

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.