Command Line API
• Firebug, Chrome Devtools
• $(selector), $$(selector), $x(xpath)
• profile, profileEnd
• inspect
• monitorEvents, unmonitorEvents
DEMO
Slide 17
Slide 17 text
Chrome Devtools
• Useful Keyboard Shortcuts
– Esc Bring the console up
– Cmd-O Search file names
– Cmd-Shift-O Search for functions (.js) and CSS selectors (.css)
– Cmd-Opt-F Search in all source files
– Cmd-1-8 / Cmd-[ / Cmd-] Navigate between panels
– Ctrl-, / Ctrl-. Previous/Next call frame
– Shift-Enter Multiline JavaScript
– Cmd-F (Resources Panel) Search in all resources
DEMO
Slide 18
Slide 18 text
Firebug
• Log function calls
• Break on cookie changes
Slide 19
Slide 19 text
Edit and Continue (JS)
• Edit JavaScript without a page refresh
– External scripts can be modified
• Existing function references are replaced
• Useful for modifying callbacks on-the-fly
DEMO
Slide 20
Slide 20 text
Debugging HTML5 Features
Slide 21
Slide 21 text
Debugging HTML5 Features
• Canvas
• Web Workers
• WebSockets
• Offline Data
– LocalStorage
– SessionStorage
– IndexedDB
– Web SQL Database
– FileSystem
Miscellaneous
• Bookmarklets to inject code into pages
– DevTools Code Snippets
• DevTools workspaces and local files
• Firebug Lite for IE (compat mode in IE 10)
• Chrome record and playback modes
– open -a "Google Chrome" --args --record-mode
– open -a "Google Chrome" --args --playback-mode
• performance.now()
DEMO
Slide 32
Slide 32 text
Demo and Source Code
http://deceptiveweb.com/js-debug/