10. What we’re diving into today
JS
… plus
● Layers
● Performance
● Coverage
DOM
+
CSS
11. Elements panel
You can see:
● the box model
● the event listeners
● DOM “breakpoints”
Live editing:
● Add new inline style
● Edit classes style
12. “Secret” panel: Layers
You can see:
● the painting layers
Example:
http://diana-adrianne.com/purecss-francine/
13. Console panel
Environment where you
can experiment and
hack some JS.
Usually powerful tool to
read debug statement
and locally debug on his
own, but his real power
comes from when
combined together when
other panels
14. Console panel + Elements panel
When you’re in any
other panel, hitting the
ESC key will trigger the
console panel to pop up
at the bottom
15. Console panel + Elements panel tips & tricks
● $( … ) is a shortcut to document.querySelector()
$(‘img’) -> <img … />
● $0 - $4 can be used to reference the last 5 DOM elements inspected
$0 is the last selected DOM element
$1 is the previous one
etc…
● $$( …) is a shortcut to document.querySelectorAll()
$$(‘img’) -> [ <img … /> .. ]
20. Console panel + Source panel tips & tricks
● set a breakpoint then use the console to inspect the local scope
● $_ is useful to get the last expression result
● console.trace is your friend when debugging async code
● console.profile (+ console.profileEnd) will programmatically activate
and end the JS profiler
● Rather than console.log( variable ) use console.log({variable})
More tricks: https://developers.google.com/web/tools/chrome-devtools/console/console-
reference
21. Source panel - Complete Debugging demo
Web Worker
Expensive task
Main Thread
Expensive task
38. Console - Tips
moz://a
https://developer.mozilla.org/en-US/docs/Tools/Web_Console.
If you have an element currently selected in your Inspector, you can use the reference $0 to call it within
your code. For example, to see the elements' contents you would type $0.innerHTML.
For previous you can use temp0 and so on.
To access to the document.querySelectorAll you can use $$.
To access to the document.querySelector you can use $.
To access to the previous value returned in console $_.
To copy the HTML of object you can use copy($0).
To inspect an object inspect($0).