Highly recommended Google Chrome debugging tips booklet, a dime. The following is only a quick summary of the content, not recommended. Say, inexplicable look very burning feeling, ha ha ha ~
copy & saving
- The input
copy(location)
, and then paste in any place, copy is particularly easy to use! - Right-click the console output to save it as a global variable
- Right – click the console error message to export the information to a file
Common Shortcut keys
command + shift + d
Switch the position of the consolecommand + [
You can quickly switch between different panels of the consoleOption + write
Increase the value by 0.1,Shift + write
Let’s increase the number by 10,write
Let’s increase the number by 1- In the Elements panel,
command+f
Support selector lookup, stunned.logs sources network
You can also look it up
The command panel
- The console
command + shift + p
Yeah, shortcuts like vscode, cool! - The input
screen
Can be selected on the current pagefull size
All the screenshots - The input
layout
The Elements panel can be split vertically or horizontally - The input
theme
You can switch to black and white mode - The input
time
Can display the console print data time
The use of snippets to quickly execute some code in the console
command + shift + p
Open the Command panel- The input
snippet
Select Create code block - delete
>
, the input!
, you can choose to execute the corresponding code block
console
$('h1')
I can just get h1,? ('h1')
You can turn a list of elements into an array list without jquery
- You can type directly with await
response = await fetch('https://jsonplaceholder.typicode.com/todos/1'); json = await response.json()
- The input
queryObjects(Vue)
All vUE instances are displayed, as are other classes
- The input
value=null; Console. assert(value,'value is null ')
If value is falsy, it will print the following - The input
var a=1; var b=2; console.log({a,b}); console.table({a,b})
, you can match the printed value to the variable - The input
console.table(? ('li'),['textContent','className'])
The second argument is the key that you want to display only. Of course the object is also no problem ~~~ - The input
console.dir($('body'))
, dir can easily print specific node information - The input
console.time('for'); console.timeEnd('for')
You can print the time difference between the two lines of code, which is a handy way to test for example how long the for loop takes - The input
Console. log('%c needed to output information ','color:#f69')
, %c and style can be used to pattern log - The input
function log(message) { console.log(' '.repeat(new Error().stack.match(/\n/g).length - 2) + message ); }; function a(){log('a'); b()}; function b(){log('b')}; a()
The log is automatically indented based on the call stack - Console. log can be directly in the callback.
Breakpoints in the Source panel
- Right-click the line number of a breakpoint to edit the execution conditions of the breakpoint so that it is a breakpoint in some cases
- The one above is for this function. Since the edit condition is executed every time the breakpoint is reached, you can simply print what you want in the edit condition. And then when you don’t
breakpoints
That clears out all the conditions. The benefit is that there is no contamination of the code, no manual comments or console code to start.
The network panel
- Right click request in
initiator
You can see the stack for the request invocation - Right click on the
Name
You can choose which data to look at in a request, such as addmethod
- Right click on a request, yes
replay xhr
Resend the request
The elements panel
- Select a node and press
The h key
Displays or hides the node - Select a node, drag it to any location, and the view will change directly
- Select a node and hold
command
, you can also quickly change the node position by pressing the up or down key - Select a node and right-click
edit html
Can be used whencommand+z
undo - Select a node and right-click
expand recuirsively
You can expand all child nodes at once - Select a node and right-click
break on
Nodes can be given break points in three forms: child nodes, current nodes, and current node removal - In the style
box-shodow
You can open the shadow editor directly - In the style
animation
The animation effect can be directly edited bezier curve - Style has a quick edit element in the bottom right corner of each element
color background-color text-shadow box-shadow
- The color panel can be directly used by the color absorber, other gameplay blasting
Drawer
- There is usually only one console panel, but you can also open as many as a drawer, and different console panels display different tabs, which is also very easy to debug in some cases.
command+ shift+p
The inputdrawer
, choose gameplay - Can simulate you in any position!
command+ shift+p
The inputdrawer
, the choice ofsensor
You can enter a virtual location. The selected value will be the navigator. Geolocation. WatchPosition (or. GetCurrentPosition) report. - Can simulate network speed and UA!
command+ shift+p
The inputdrawer
, the choice ofnetwork
You can do whatever you want - Can quickly look at the source code!
command+ shift+p
The inputdrawer
, the choice ofquick source
You can do whatever you want - A quick look at excess code!
command+ shift+p
The inputdrawer
, the choice ofcoverage
Click on the dot to start, then click on the specific document to see the red and green areas - You can quickly compare the style before and after the modification!
command+ shift+p
The inputdrawer
, the choice ofchange
workspace
- I can read the lost file, hahaha