markdown Chrome Dev Tools.md
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Chrome Dev Tools.md相关的知识,希望对你有一定的参考价值。
https://medium.freecodecamp.org/cool-chrome-devtools-tips-and-tricks-you-wish-you-knew-already-f54f65df88d2
## Drag-and-drop in the Elements panel
In the Elements panel, you can drag and drop any HTML element and change its position across the page.
![enter image description here](https://lh3.googleusercontent.com/TzhHkdxmD6iQdoWhi4gYJi0m3r-6mIfrIlF2-FKWoImas4CI7szFs70fBqCifMlxaiMQPr9ViD3BLQ "Image")
## Reference the currently selected element in the Console
Select a node in the Elements panel, and type `$0` in the console to reference it.
If you’re using jQuery, you can enter `$($0)` to access the jQuery API on this element.
![enter image description here](https://lh3.googleusercontent.com/dPcABShbeMvYlg0HNe3Rr6XKdKl8Me017S3rzlK-HAgvDQ_KTeGAgP7nLTJO4pE_C3dvOYqJrySmHg)
## Use the value of the last operation in th Console
Use `$_` to reference the return value of the previous operation executed in the Console
![enter image description here](https://lh3.googleusercontent.com/axvcE8258U7fYsM2goScZDXRlbXjhp1i0qneXSVrkozLu-LyKQxpsgA7fdFPSlyX63GCt5NMvbkGOA)
## Add CSS and edit the element state
In the Elements panel there are two super useful buttons.
The first lets you add a new CSS property with any selector you want, but pre-filling the currently selected element:
![enter image description here](https://lh3.googleusercontent.com/1ZohP7FG6pVvuAzv94DNIgSgH39WosaHOw7qOXJvlCL8qfyp9liVFS8uBXGlzl5mh7bNshfdZrSVfg)
The second one lets you trigger a state for the selected element, so you can see the styles applied when it’s active, hovered, or on focus.
![enter image description here](https://lh3.googleusercontent.com/qIyP-nndhMEvy6PDITVAgwjM-gkSNaSywgWZBm0WiS17Wuc5I5sZ-ZKpiuq0oi18jTTl_TCXbKWL-w)
## Save to file the modified CSS
Click the name of the CSS file that you edited. The inspector opens it into the Sources pane, and from there you can save it with the live edits you applied.
This trick does not work for new selectors added using +, or into the element.style properties, but only for modified, existing ones.
![enter image description here](https://lh3.googleusercontent.com/GN1zM2d7UDxLIt2CfUCjH8Hd2JBrt2b1mrQgCVifo2msejkupG8hhrgmF0eyw-HCU20FjYw27N6Ziw)
## Screenshot a single element
Select an element and press cmd-shift-p (or ctrl-shift-p in Windows) to open the Command Menu, and select Capture node screenshot
![enter image description here](https://lh3.googleusercontent.com/wCixptGA1GGtf1KMoayGjQwicCwCy3z0GD0489Rgh9Zed8tK1LCQXHEUHYk-2mN6I1vppI8GQPfzSw)
## Find an element using CSS selectors
Pressing cmd-f (ctrl-f in Windows) opens the search box in the Elements panel.
You can type any string in there to match the source code, or you can also use CSS selectors to have Chrome generate an image for you:
![enter image description here](https://lh3.googleusercontent.com/eJ7-JbQ0kYDwh6C5oIQv_4pG5Dw3qBIBWGjrWk0exe2Yf2OLjYfFiJ9398QnQhg_gSSS-e12xxMD4A)
## Shift-enter in the Console
To write commands that span over multiple lines in the Console, press `shift-enter`.
Once you’re ready, press enter at the end of the script to execute it:
![enter image description here](https://lh3.googleusercontent.com/TpDiK5ygzcM2uYKnu_0xf3IAg7jt2ivoZpKjUAlqZgCkDrCLCtrWXLeQlN_7tHP38KZugJR1tp7FvA)
You can clear the console using the Clear button on the top-left of the console, or by pressing ctrl-l or cmd-k.
## Go to…
In the Sources panel:
* `cmd+o` or `cmd+p` (`ctrl+o` or `ctrl+p` in Windows), shows all the files loaded by your page.
* `cmd+shift+o` (`ctrl-shift-o` in Windows) shows the symbols (properties, functions, classes) in the current file.
* `ctrl+g` goes to a specific line.
*
![enter image description here](https://lh3.googleusercontent.com/x83oophlp3d4ekARaNOK8HW8XuYwqU_PzDhU_v0DBUVWyENyz0KlvEVf1KrSLTZm3pMicUchmAOsrw)
## Watch Expression
Instead of writing again and again a variable name or an expression you are going to check a lot during a debug session, add it to the Watch Expression list.
![enter image description here](https://lh3.googleusercontent.com/6SxoMrjbSMaqWHw4JgdEtt8qwBm7_dl7B54aBmhMb8fBqXc2qNn7XC_FMAcDvIZPWF5Bv5dLz814_Q)
## XHR/Fetch debugging
From the debugger open the XHR/Fetch Breakpoints panel.
You can set it to break any time an XHR/Fetch call is sent, or just on specific ones:
![enter image description here](https://lh3.googleusercontent.com/AxfAVdq5oRMUiGXXklOaLfPEQAEidnEAeTCL0Qpczzd3Vd1nRsijnRUF0bwObi1kKa1Dn8S4PVaoyQ)
## Debug on DOM modifications
Right-click an element and enable Break on Subtree Modifications. Whenever a script traverses that element’s children and modifies them, the debugger stops automatically to let you inspect what’s happening.
![enter image description here](https://lh3.googleusercontent.com/Ti90gtanW3LUTgjnmi_JajqQQ2NwH4o2npsFhLKkB4Ge6n7Z_lDZy4UMeg5tE93GGmPxnym8gvAehA)
## Local Overrides
Use the Local Overrides feature to map remote network resources to local filesystem resources.
This powerful workflow enables you to quickly prototype changes on production websites. To try this feature out:
Open up the Overrides pane from the Sources Panel.
Select Select folder for Overrides and configure a folder where your overridden resources will live on the filesystem.
In the Network Panel, right click on a resource you wish to override and select Save for overrides.
DevTools creates a local resource which you can edit. Reloads to the webpage now serve your local asset rather than a remote resource.
![enter image description here](https://lh3.googleusercontent.com/DTI8rPX_bipu3XgVmoMFDc_uJlsoNh8If7fcuVaP7D0Yep5XI497EoV3uNd-ZKXOVKWNbKFa1_B74g)
以上是关于markdown Chrome Dev Tools.md的主要内容,如果未能解决你的问题,请参考以下文章
谷歌 Chrome Dev Tools 浅析 – 成为更高效的 Developer
For loop let scope stackblitz vs chrome dev tools
Chrome web.dev Live 2020总结:Dev Tools时间轴中的核心网络生命