<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>DevTools Tips</title>
  <subtitle>A collection of useful, cross-browser, tips and tricks to get more comfortable with using DevTools.</subtitle>
  <link href="https://devtoolstips.org/feed.xml" rel="self"/>
  <link href="https://devtoolstips.org/"/>
  <id>https://devtoolstips.org/</id>
  <updated>2025-02-27T00:00:00.000Z</updated>
  <author>
    <name>Patrick Brosset</name>
    <email>patrickbrosset@gmail.com</email>
  </author>
  
  <entry>
    <title>Override network responses with local files</title>
    <link href="https://devtoolstips.org/tips/en/override-responses-with-files/"/>
    <updated>2025-02-27T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/override-responses-with-files/</id>
    <content type="html">&lt;p&gt;To test a quick fix locally, in DevTools, without editing the source file and deploying it to a server, override network responses with local files.&lt;/p&gt;
&lt;h2 id=&quot;firefox&quot; tabindex=&quot;-1&quot;&gt;Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/override-responses-with-files/#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the request which you want to override.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Right-click the request and select &lt;strong&gt;Set Network Override&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose a location on your computer to save the response.&lt;/p&gt;
&lt;p&gt;The current response to the request is saved to that location.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the local file in a text editor, make the necessary changes, and save the file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Reload the page.&lt;/p&gt;
&lt;p&gt;DevTools now uses the local file, with your modifications, as the response instead of the original server response.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To remove the override, right-click the request again and select &lt;strong&gt;Remove Network Override&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/override-responses-with-files-1.png&quot; alt=&quot;The Network tool in Firefox DevTools. A request was right-clicked, the contextual menu is visible, and the Set Network Override menu item is highlighted.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;chrome-and-edge&quot; tabindex=&quot;-1&quot;&gt;Chrome and Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/override-responses-with-files/#chrome-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the request which you want to override.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Right-click the request and select &lt;strong&gt;Override content&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the banner that appears at the top of DevTools, click &lt;strong&gt;Select folder&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose a location on your computer to save the response, and click &lt;strong&gt;Allow&lt;/strong&gt; to let DevTools access the folder.&lt;/p&gt;
&lt;p&gt;A new folder, matching the website&#39;s domain name, is created at that location, and the current response to the request is saved in that folder.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the local file in a text editor, make the necessary changes, and save the file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Reload the page.&lt;/p&gt;
&lt;p&gt;DevTools now uses the local file, with your modifications, as the response instead of the original server response.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To remove the override:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Sources&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the left pane, click &lt;strong&gt;Overrides&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To temporarily disable the override, clear the &lt;strong&gt;Enable Local Overrides&lt;/strong&gt; checkbox.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To permanently remove the override, click &lt;strong&gt;Clear configuration&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/override-responses-with-files-2.png&quot; alt=&quot;The Network tool in Chrome DevTools. A request was right-clicked, the contextual menu is visible, and the Override content menu item is highlighted.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Create contextual console loggers</title>
    <link href="https://devtoolstips.org/tips/en/create-contextual-console-loggers/"/>
    <updated>2025-02-14T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/create-contextual-console-loggers/</id>
    <content type="html">&lt;p&gt;Applications are often made up of multiple subsystems or components, each with its own set of log messages. When you&#39;re debugging such an application, it might be hard to find the logs you&#39;re looking for in the &lt;strong&gt;Console&lt;/strong&gt; tool, as the logs from all of the different parts of the app are mixed together.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;console.context()&lt;/code&gt; can help you with this. This console API is an experiment in Chromium-based browsers only, but is a good step in the right direction.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a specific logger instance for a part of your app:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;const myComponentLogger = console.context(&amp;quot;name-of-my-component&amp;quot;);&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then log messages as normal, using your new logger:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;myComponentLogger.log(&amp;quot;This is a log message from my component&amp;quot;);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;myComponentLogger.warn(&amp;quot;This is a warning message from my component&amp;quot;);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For an even nicer experience, give your logger a color:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;myComponentLogger.log(&amp;quot;%cThis is a log message from my component&amp;quot;, &amp;quot;background-color:lemonchiffon;&amp;quot;);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Here is what the &lt;strong&gt;Console&lt;/strong&gt; tool might look like, with the logs from all of the components of the app:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/create-contextual-console-loggers-1.png&quot; alt=&quot;Console tool in Edge DevTools, showing many logs of different colors, coming from different components of the app.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When reviewing logs in the &lt;strong&gt;Console&lt;/strong&gt; tool, filter the messages by using the name of the context:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Filter&lt;/strong&gt; to focus the search field.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter &lt;strong&gt;context:name-of-my-component&lt;/strong&gt; to see only the logs from your component.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here is what the &lt;strong&gt;Console&lt;/strong&gt; tool would show, once the logs have been filtered by context, to show only the logs from one component:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/create-contextual-console-loggers-2.png&quot; alt=&quot;Console tool in Edge DevTools, showing the logs of only one component. The filter &amp;quot;context:storage&amp;quot; was entered.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  
  <entry>
    <title>Find in files</title>
    <link href="https://devtoolstips.org/tips/en/find-in-files/"/>
    <updated>2024-12-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-in-files/</id>
    <content type="html">&lt;p&gt;To find occurrences of a string in all of the files of the webpage you are inspecting, for example to find where a specific CSS class is defined, or where a specific JavaScript API is used:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Firefox:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Debugger&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Press &lt;kbd&gt;Ctrl+Shift+F&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+Option+F&lt;/kbd&gt; on macOS).&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Search&lt;/strong&gt; sidebar panel appears.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the string you want to search for and then press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/p&gt;
&lt;p&gt;The results are displayed in the &lt;strong&gt;Search&lt;/strong&gt; sidebar panel.&lt;/p&gt;
&lt;p&gt;Results from CSS stylesheets don&#39;t appear in the results however. To find occurrences in CSS stylesheets, open the &lt;strong&gt;Style Editor&lt;/strong&gt; tool and press &lt;kbd&gt;Ctrl+F&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+F&lt;/kbd&gt; on macOS).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click one of the results to display the file, at the right location, in the &lt;strong&gt;Debugger&lt;/strong&gt; tool.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-in-files-firefox.png&quot; alt=&quot;The Debugger tool in Firefox, showing the Search sidebar panel. A search for the word &amp;quot;trace&amp;quot; was done, and a list of matches appear in the panel.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Chrome or Edge:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Press &lt;kbd&gt;Ctrl+Shift+F&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+Option+F&lt;/kbd&gt; on macOS).&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Search&lt;/strong&gt; tool appears in the bottom drawer area.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the string you want to search for and then press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/p&gt;
&lt;p&gt;The results are displayed in the &lt;strong&gt;Search&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click one of the results to display the file, at the right location, in the &lt;strong&gt;Sources&lt;/strong&gt; tool.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-in-files-chrome.png&quot; alt=&quot;The Search tool in the drawer area of  Chrome devtools. A search for the word &amp;quot;trace&amp;quot; was done, and a list of matches appear in the drawer.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Safari:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Missing content. Click &lt;strong&gt;Edit this page&lt;/strong&gt;, at the bottom of the page, to add the missing content.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Missing content. Click &lt;strong&gt;Edit this page&lt;/strong&gt;, at the bottom of the page, to add the missing content.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Extend traces recorded in the Performance tool with your own custom data</title>
    <link href="https://devtoolstips.org/tips/en/extend-performance-traces/"/>
    <updated>2024-11-26T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/extend-performance-traces/</id>
    <content type="html">&lt;p&gt;The &lt;strong&gt;Performance&lt;/strong&gt; tool lets you add custom tracks with your own custom events, when recording performance traces. This is useful to surface your own performance data, which might not map directly to the functions defined in the code.&lt;/p&gt;
&lt;p&gt;To extend traces, use the &lt;a href=&quot;https://developer.mozilla.org/docs/Web/API/Performance_API&quot;&gt;Performance API&lt;/a&gt; in your JavaScript code. For example, to start measuring a custom event, you can use &lt;code&gt;performance.now()&lt;/code&gt; as shown below:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; start &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; performance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, later in your code, you can stop measuring that event, and display it in a custom track in the &lt;strong&gt;Performance&lt;/strong&gt; tool:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;performance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;measure&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;Analyse&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  start&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  end&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; performance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  detail&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    devtools&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;      dataType&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;track-entry&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token comment&quot;&gt;// The name of the custom track.&lt;/span&gt;&lt;br /&gt;      track&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Feature handling&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token comment&quot;&gt;// Custom properties of the event, displayed in the Summary pane, when the event is selected.&lt;/span&gt;&lt;br /&gt;      properties&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; id&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;size&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; size&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token comment&quot;&gt;// Tooltip text which appears when hovering over the event in the custom track.&lt;/span&gt;&lt;br /&gt;      tooltipText&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;Feature &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;id&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you later record a performance trace in the tool, a new track named &lt;strong&gt;Feature handling&lt;/strong&gt; is displayed in addition to the &lt;strong&gt;Main&lt;/strong&gt; track where the function call stacks and other browser rendering events are displayed. The custom events you added are displayed in this new custom track.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/extend-performance-traces.png&quot; alt=&quot;A trace displayed in the Performance tool of Chrome DevTools, showing a custom track called &amp;quot;Feature handling&amp;quot;, and containing custom events.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Visualize a webpage&#39;s memory usage during a performance recording</title>
    <link href="https://devtoolstips.org/tips/en/visualize-memory-usage-during-perf-recording/"/>
    <updated>2024-10-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/visualize-memory-usage-during-perf-recording/</id>
    <content type="html">&lt;p&gt;To check how much memory a webpage consumes over the time of a specific user scenario, and to identify potential memory leaks, you can use the &lt;strong&gt;Memory&lt;/strong&gt; tool in Chrome or Edge DevTools with the &lt;strong&gt;Memory&lt;/strong&gt; option.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools and go to the &lt;strong&gt;Performance&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the toolbar, enable the &lt;strong&gt;Memory&lt;/strong&gt; option.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Record&lt;/strong&gt; to start the recording.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Interact with the page like a user would, to simulate the user scenario you want to analyze.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Stop&lt;/strong&gt; to end the recording.&lt;/p&gt;
&lt;p&gt;Once the resulting profile appears in the tool, a memory graph is displayed below the main flame chart area.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The memory graph shows the memory usage of the page over the time of the recording. For example, you can see how the JS heap memory (i.e, the memory region where all the JavaScript objects live) usage evolves when new objects get created (the blue line goes up) and then get garbage collected (sudden drops on the blue line).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/visualize-memory-usage-during-perf-recording.png&quot; alt=&quot;Chrome DevTools&#39; Memory tool, showing a recorded performance profile that has a memory graph section&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Override source files to test changes in the browser</title>
    <link href="https://devtoolstips.org/tips/en/override-source-files/"/>
    <updated>2024-10-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/override-source-files/</id>
    <content type="html">&lt;p&gt;It can be helpful to make quick changes to the source code that a site uses, especially when debugging a site in production. For example, if you suspect that a bug is caused by a specific line of code, and you want to test a fix, it can be faster and easier to make the required change temporarily on the production code directly, rather than setting up a local development environment.&lt;/p&gt;
&lt;p&gt;Chrome, Edge, and Firefox allow you to temporarily override any source file that a site uses with files stored locally on your computer.&lt;/p&gt;
&lt;p&gt;Note that the files are only overridden while DevTools is open, and no changes are made to the original files on the server.&lt;/p&gt;
&lt;h2 id=&quot;override-files-in-the-firefox-devtools-debugger-tool&quot; tabindex=&quot;-1&quot;&gt;Override files in the Firefox DevTools Debugger tool &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/override-source-files/#override-files-in-the-firefox-devtools-debugger-tool&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In Firefox DevTools, open the &lt;strong&gt;Debugger&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Sources&lt;/strong&gt; panel, find the file that you want to override.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Right-click the file and select &lt;strong&gt;Add script override&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;A file explorer window opens.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose a location for the file override and submit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make changes to the local file stored at the location you chose.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refresh the page in Firefox to see the changes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;override-files-in-the-chrome-or-edge-devtools-sources-tool&quot; tabindex=&quot;-1&quot;&gt;Override files in the Chrome or Edge DevTools Sources tool &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/override-source-files/#override-files-in-the-chrome-or-edge-devtools-sources-tool&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In Chrome or Edge DevTools, open the &lt;strong&gt;Sources&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the right pane, open the &lt;strong&gt;Overrides&lt;/strong&gt; tab. You might need to click the &lt;strong&gt;More tabs&lt;/strong&gt; chevron icon to see that tab.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Select folder for overrides&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;A file explorer window opens.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose a folder for the file overrides to be stored in, and then submit.&lt;/p&gt;
&lt;p&gt;DevTools requests your permission to access the file system, click &lt;strong&gt;Allow&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the right pane, open the &lt;strong&gt;Page&lt;/strong&gt; tab.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the file that you want to override and click it.&lt;/p&gt;
&lt;p&gt;The file content appears in the editor.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make changes to the file content, and then save the file.&lt;/p&gt;
&lt;p&gt;The changes get saved locally within a subfolder of the folder you chose. The subfolder is named after the domain of the site you&#39;re debugging. If you go to another site and override a file from that site, the overrides are stored in another subfolder of the folder your chose.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refresh the page in Chrome or Edge to see the changes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  
  <entry>
    <title>Override HTTP response headers</title>
    <link href="https://devtoolstips.org/tips/en/override-headers/"/>
    <updated>2024-07-18T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/override-headers/</id>
    <content type="html">&lt;p&gt;With DevTools, you can override the response headers of a network request and test your website under different conditions.&lt;/p&gt;
&lt;p&gt;HTTP response headers are metadata sent by the server to the browser, along with a response such as an HTML page, or a JS, CSS, or image resource. These headers control how the browser handles the response, such as caching, content type, and various features or security settings.&lt;/p&gt;
&lt;p&gt;Overriding response headers from within DevTools means that you can test all of these aspects without needing to modify the server, which can be useful when you don&#39;t have access to the server, or to do quick tests.&lt;/p&gt;
&lt;p&gt;For example, the JS self-profiling API allows you to run a JavaScript profiler, programmatically, on your website, and requires the &lt;code&gt;Document-Policy: js-profiling&lt;/code&gt; header to be set. If you want to test your JS self-profiling code locally, without adding the header to your server, override the response header in DevTools:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open Chrome or Edge DevTools, and go to the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Reload the page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the request for which you want to override the response headers. In the example above, you would look for the initial HTML request.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Right-click on the request and select &lt;strong&gt;Override headers&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Headers&lt;/strong&gt; tab appears in the side panel, with a list of existing response headers under the section &lt;strong&gt;Response Headers&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To add a new header, click the &lt;strong&gt;+ Add header&lt;/strong&gt; button.&lt;/p&gt;
&lt;p&gt;A new row appears in the list of headers, where you can enter the name and value of the header you want to add.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a header name, such as &lt;code&gt;Document-Policy&lt;/code&gt;, and a value, such as &lt;code&gt;js-profiling&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To edit an existing header, click on the header value and enter a new value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Reload the page.&lt;/p&gt;
&lt;p&gt;The resource for which you overrode the headers should now be loaded with the new headers.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/override-headers.png&quot; alt=&quot;Edge DevTools Network tool, the initial HTML request is selected, the Response Headers section is visible in the sidebar, showing the Add header button, and the new header.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Hide elements from the page, without changing the layout</title>
    <link href="https://devtoolstips.org/tips/en/hide-elements/"/>
    <updated>2024-06-12T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/hide-elements/</id>
    <content type="html">&lt;p&gt;In the DevTools&#39; &lt;strong&gt;Elements&lt;/strong&gt; (or &lt;strong&gt;Inspector&lt;/strong&gt;) tool, you can delete nodes from the DOM tree by selecting them in the tool and then pressing &lt;kbd&gt;Delete&lt;/kbd&gt; or &lt;kbd&gt;Backspace&lt;/kbd&gt;. While this is great to completely remove the elements and make others take more space for example, it can also break the CSS layout of the page.&lt;/p&gt;
&lt;p&gt;Hiding elements without altering the DOM tree or the layout can be useful in some cases, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When elements overlap each other, and you want to see what&#39;s behind them.&lt;/li&gt;
&lt;li&gt;When you want to take a screenshot of the page without some information being visible.&lt;/li&gt;
&lt;li&gt;When you want to focus on just one part of the page without being distracted by other elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;in-chrome%2C-edge%2C-or-firefox&quot; tabindex=&quot;-1&quot;&gt;In Chrome, Edge, or Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/hide-elements/#in-chrome%2C-edge%2C-or-firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To hide an element without removing it from the DOM tree, in DevTools:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to the &lt;strong&gt;Elements&lt;/strong&gt; tool (called &lt;strong&gt;Inspector&lt;/strong&gt; in Firefox).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the element you want to hide.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Either from the page, by right-clicking on it and selecting &lt;strong&gt;Inspect&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Or from the tool, by finding and clicking on the element in the DOM tree.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Press &lt;kbd&gt;H&lt;/kbd&gt; on your keyboard.&lt;/p&gt;
&lt;p&gt;The element remains in the DOM tree, but becomes invisible in the page.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To show the element again, make sure it&#39;s selected in the &lt;strong&gt;Elements&lt;/strong&gt;/&lt;strong&gt;Inspector&lt;/strong&gt; tool, and press &lt;kbd&gt;H&lt;/kbd&gt; again.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/hide-elements.png&quot; alt=&quot;Chrome with DevTools opened, showing how pressing H hides elements from the page&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-polypane&quot; tabindex=&quot;-1&quot;&gt;In Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/hide-elements/#in-polypane&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select the element you want to hide in the &lt;strong&gt;Elements&lt;/strong&gt; panel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the &lt;strong&gt;Eye&lt;/strong&gt; icon in the toolbar.&lt;/p&gt;
&lt;p&gt;The icon changes from an open eye to a closed eye.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the icon again to show the element again.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/hide-elements-polypane.png&quot; alt=&quot;Polypane with the Elements panel opened, showing how Clicking the eye icon hides elements from the page&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Pick a color from the webpage, or the screen</title>
    <link href="https://devtoolstips.org/tips/en/pick-a-color-from-the-page/"/>
    <updated>2024-06-11T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/pick-a-color-from-the-page/</id>
    <content type="html">&lt;p&gt;When working with the CSS of a webpage, from the &lt;strong&gt;Elements&lt;/strong&gt; or &lt;strong&gt;Inspector&lt;/strong&gt; tool, in DevTools, there may be times when you want to reuse a existing color from the webpage, or from the screen, but might not know the exact color value. This can happen, for example, in cases when the color you want to pick is part of an image.&lt;/p&gt;
&lt;p&gt;To copy the color value from a pixel on the inspected webpage, or on the entire screen, use the &lt;strong&gt;Eye Dropper&lt;/strong&gt; tool in DevTools.&lt;/p&gt;
&lt;h2 id=&quot;in-firefox&quot; tabindex=&quot;-1&quot;&gt;In Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/pick-a-color-from-the-page/#in-firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Firefox, you can use the &lt;strong&gt;Eye Dropper&lt;/strong&gt; tool in two ways: either to copy a color to the clipboard, or to change a color in the CSS code displayed in the &lt;strong&gt;Rules&lt;/strong&gt; tab.&lt;/p&gt;
&lt;h3 id=&quot;copy-a-color-to-the-clipboard&quot; tabindex=&quot;-1&quot;&gt;Copy a color to the clipboard &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/pick-a-color-from-the-page/#copy-a-color-to-the-clipboard&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools and go to the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the &lt;strong&gt;Grab a color from the page&lt;/strong&gt; button, that&#39;s located in the &lt;strong&gt;Inspector&lt;/strong&gt; toolbar, above the DOM tree panel.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Eye Dropper&lt;/strong&gt; tool appears in the page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Move your cursor over the webpage to find the color you want to copy, and then click.&lt;/p&gt;
&lt;p&gt;The color value is copied into your clipboard.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/pick-a-color-from-the-page-firefox-1.png&quot; alt=&quot;The Eye Dropper tool in Firefox, copying a color from the webpage&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;change-a-color-in-the-css-code&quot; tabindex=&quot;-1&quot;&gt;Change a color in the CSS code &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/pick-a-color-from-the-page/#change-a-color-in-the-css-code&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools and go to the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the CSS color value you want to change in the &lt;strong&gt;Rules&lt;/strong&gt; tab.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the colored circle next to the color value.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Color Picker&lt;/strong&gt; dropdown appears.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the &lt;strong&gt;Eye Dropper&lt;/strong&gt; icon that&#39;s displayed in the bottom left corner of the &lt;strong&gt;Color Picker&lt;/strong&gt; dropdown.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Eye Dropper&lt;/strong&gt; tool appears in the page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Move your cursor over the webpage to find the color you want to use, and then click.&lt;/p&gt;
&lt;p&gt;The color value that&#39;s displayed in the &lt;strong&gt;Rules&lt;/strong&gt; tab is changed to match the color you selected.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/pick-a-color-from-the-page-firefox-2.png&quot; alt=&quot;The Color Picker in the Rules tab of Firefox DevTools, showing the Eye Dropper icon to change a color value in the CSS code&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-chrome%2C-edge%2C-and-safari&quot; tabindex=&quot;-1&quot;&gt;In Chrome, Edge, and Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/pick-a-color-from-the-page/#in-chrome%2C-edge%2C-and-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chrome and Edge don&#39;t have a way to copy a color to your clipboard. They only support using the &lt;strong&gt;Eye Dropper&lt;/strong&gt; tool to change a color displayed in the CSS code in the &lt;strong&gt;Styles&lt;/strong&gt; pane. However, these browsers support grabbing a color from the &lt;em&gt;entire screen&lt;/em&gt;, not just the webpage.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools and go to the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the CSS color value you want to change in the &lt;strong&gt;Styles&lt;/strong&gt; pane.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the colored square next to the color value.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Color Picker&lt;/strong&gt; dropdown appears.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the &lt;strong&gt;Eye Dropper&lt;/strong&gt; icon in the &lt;strong&gt;Color Picker&lt;/strong&gt; dropdown.&lt;/p&gt;
&lt;p&gt;Your cursor changes into the &lt;strong&gt;Eye Dropper&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Move your cursor over the webpage or the screen to find the color you want to use, and then click.&lt;/p&gt;
&lt;p&gt;The color value that&#39;s displayed in the &lt;strong&gt;Styles&lt;/strong&gt; pane is changed to match the color you selected.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/pick-a-color-from-the-page-chrome.png&quot; alt=&quot;The Color Picker in Chrome DevTools, showing the Eye Dropper button&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-polypane&quot; tabindex=&quot;-1&quot;&gt;In Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/pick-a-color-from-the-page/#in-polypane&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click the &lt;strong&gt;Eye Dropper&lt;/strong&gt; icon in the browser top toolbar.&lt;/p&gt;
&lt;p&gt;Your cursor changes into the &lt;strong&gt;Eye Dropper&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Move your cursor over the Polypane UI or over the screen to find the color you want to use, and then click.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Eye Dropper&lt;/strong&gt; UI appears, showing the selected color, as well previously selected colors, and contrast ratio information.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/pick-a-color-from-the-page-polypane.png&quot; alt=&quot;The Eye Dropper icon and Eye Dropper UI in Polypane&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Highlight areas that the browser engine re-paints</title>
    <link href="https://devtoolstips.org/tips/en/highlighted-repainted-areas/"/>
    <updated>2024-06-11T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/highlighted-repainted-areas/</id>
    <content type="html">&lt;p&gt;When you scroll through a webpage, or when parts of the webpage change, the browser engine sometimes needs to repaint parts of the page. The process of converting the layout and style information into pixels on the screen is specific to each browser engine, but it can be quite expensive in terms of performance, especially when the repainted areas are large and when repaints occur often.&lt;/p&gt;
&lt;p&gt;Use &lt;strong&gt;Paint flashing&lt;/strong&gt; in DevTools if you suspect that your webpage is slow because of frequent and large repaints. &lt;strong&gt;Paint flashing&lt;/strong&gt; highlights the areas of the webpage that the browser engine repaints, making it possible for you to visually identify the problematic areas.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: using &lt;strong&gt;Paint flashing&lt;/strong&gt; may not be suitable for people prone to photosensitive epilepsy.&lt;/p&gt;
&lt;h2 id=&quot;in-chrome-and-edge&quot; tabindex=&quot;-1&quot;&gt;In Chrome and Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/highlighted-repainted-areas/#in-chrome-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Rendering&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the &lt;strong&gt;Paint flashing&lt;/strong&gt; checkbox.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Interact with the webpage to see the areas that the browser engine repaints.&lt;/p&gt;
&lt;p&gt;As the browser engine repaints areas of the page, these areas get highlighted in a different color:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/highlighted-repainted-areas.png&quot; alt=&quot;Paint flashing in Edge&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;in-safari&quot; tabindex=&quot;-1&quot;&gt;In Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/highlighted-repainted-areas/#in-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Open the Web Inspector.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Paint flashing&lt;/strong&gt; button in the toolbar.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;in-firefox&quot; tabindex=&quot;-1&quot;&gt;In Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/highlighted-repainted-areas/#in-firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Unfortunately, Firefox no longer has a built-in paint flashing tool. This is due to the new rendering engine (WebRender) that Firefox uses, and which doesn&#39;t support paint flashing. See &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1612922&quot;&gt;Paint flashing DevTools for WebRender&lt;/a&gt; on Bugzilla if you want to follow the updates on this feature.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Display the specificity of a CSS selector</title>
    <link href="https://devtoolstips.org/tips/en/display-css-selector-specificity/"/>
    <updated>2024-06-04T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/display-css-selector-specificity/</id>
    <content type="html">&lt;p&gt;The specificity of a CSS selector is a score that the browser computes based on the different parts of the selector. It is used to determine which CSS rule takes precedence when multiple rules from the same origin and layer target the same element. &lt;a href=&quot;https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance&quot;&gt;Cascade, specificity, and inheritance&lt;/a&gt;, at MDN, is a good resource to learn more.&lt;/p&gt;
&lt;p&gt;To display the specificity of a CSS selector in DevTools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;In Chrome, Edge, Firefox, and Safari&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to the &lt;strong&gt;Elements&lt;/strong&gt; tool (called &lt;strong&gt;Inspector&lt;/strong&gt; in Firefox).&lt;/li&gt;
&lt;li&gt;Hover over a CSS selector in the &lt;strong&gt;Styles&lt;/strong&gt; pane.&lt;/li&gt;
&lt;li&gt;The specificity of the selector is displayed in a tooltip.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/display-css-selector-specificity.png&quot; alt=&quot;Chrome DevTools showing the specificity of a CSS selector in a tooltip&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;In Polypane&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Style&lt;/strong&gt; tab of the &lt;strong&gt;Elements&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;The specificity is displayed next to each CSS selectors, to the right.&lt;/li&gt;
&lt;li&gt;Click on the specificity to see how the specificity for the selector is calculated.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/display-css-selector-specificity-polypane.png&quot; alt=&quot;Polypane DevTools showing the specificity of a CSS selector&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Copy an inline SVG image&#39;s source code</title>
    <link href="https://devtoolstips.org/tips/en/copy-inline-svg-image/"/>
    <updated>2024-05-28T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/copy-inline-svg-image/</id>
    <content type="html">&lt;p&gt;To copy the SVG source code of an SVG image that&#39;s embedded directly in the HTML of a webpage, use the &lt;strong&gt;Elements&lt;/strong&gt; tool in DevTools (&lt;strong&gt;Inspector&lt;/strong&gt; in Firefox).&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;To open DevTools, right-click the SVG image in the webpage, and then click &lt;strong&gt;Inspect&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Elements&lt;/strong&gt; (or &lt;strong&gt;Inspector&lt;/strong&gt;) tool opens, with the SVG element selected in the DOM tree of the page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make sure the &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element is selected. Depending on where you right-clicked on the webpage, an element that&#39;s inside the &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element might be selected instead. If so, click the &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element to select it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To copy the SVG source code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox, Chrome, Edge, or Safari: Right-click the &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element in the &lt;strong&gt;Elements&lt;/strong&gt; (or &lt;strong&gt;Inspector&lt;/strong&gt;) tool, and then click &lt;strong&gt;Copy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copy outerHTML&lt;/strong&gt; (or &lt;strong&gt;Outer HTML&lt;/strong&gt; in Firefox).&lt;/li&gt;
&lt;li&gt;In Polypane: Click the &lt;strong&gt;Copy&lt;/strong&gt; icon and then click &lt;strong&gt;Copy Outer HTML&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The SVG source code is now copied to your clipboard.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Paste the SVG source code wherever you want to use it.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following screenshot shows the &lt;strong&gt;Copy&lt;/strong&gt; menu in Microsoft Edge:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-inline-svg-image.png&quot; alt=&quot;Copying the SVG source code in Edge DevTools&quot; /&gt;&lt;/p&gt;
&lt;p&gt;And the following screenshot shows the &lt;strong&gt;Copy&lt;/strong&gt; icon in Polypane:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-inline-svg-image-polypane.png&quot; alt=&quot;Copying the SVG source code in Polypane Elements Panel&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Alternatively, in Polypane, you can right-click the SVG and then select &lt;strong&gt;Copy SVG as...&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copy as code&lt;/strong&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Disable all CSS styles on the page</title>
    <link href="https://devtoolstips.org/tips/en/disable-all-css/"/>
    <updated>2024-04-09T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/disable-all-css/</id>
    <content type="html">&lt;p&gt;To remove all CSS styles on a webpage, for example to test the accessibility of a page when styles are disabled, or to verify the order in which content is displayed, you can use the techniques below. Don&#39;t worry, the styles will be re-enabled when you refresh the page.&lt;/p&gt;
&lt;h3 id=&quot;by-running-javascript-in-the-console&quot; tabindex=&quot;-1&quot;&gt;By running JavaScript in the console &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/disable-all-css/#by-running-javascript-in-the-console&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Console&lt;/strong&gt; tool in your browser DevTools.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the following JavaScript expression:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;style, link[rel=&quot;stylesheet&quot;]&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The expression above finds all &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; elements and &lt;code&gt;&amp;lt;link rel=&amp;quot;stylesheet&amp;quot;&amp;gt;&lt;/code&gt; elements on the page, and removes them.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Press &lt;kbd&gt;Enter&lt;/kbd&gt; to run the expression. The page is now displayed without any CSS styles:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/disable-all-css.png&quot; alt=&quot;Edge showing a website with no CSS styles. The Console tool is opened on the side, and shows that the expression to remove all stylesheets was run&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;by-using-firefox&#39;s-style-editor-tool&quot; tabindex=&quot;-1&quot;&gt;By using Firefox&#39;s Style Editor tool &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/disable-all-css/#by-using-firefox&#39;s-style-editor-tool&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Firefox has a tool named &lt;strong&gt;Style Editor&lt;/strong&gt;, which lists all the stylesheets used on the page. To disable the styles on the page:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Style Editor&lt;/strong&gt; tool in Firefox DevTools.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Toggle style sheet visibility&lt;/strong&gt; buttons (the eye icons) next to each stylesheet to disable it.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;by-using-the-sources-tool-in-other-browsers&quot; tabindex=&quot;-1&quot;&gt;By using the Sources tool in other browsers &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/disable-all-css/#by-using-the-sources-tool-in-other-browsers&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Sources&lt;/strong&gt; tool in Chrome or Edge DevTools.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the CSS files that you want to disable, for example by pressing &lt;kbd&gt;Ctrl+P&lt;/kbd&gt; (or &lt;kbd&gt;Command+P&lt;/kbd&gt; on macOS) to open the &lt;strong&gt;Command Menu&lt;/strong&gt; and by typing &lt;strong&gt;.css&lt;/strong&gt; to filter the CSS files.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the entire text in the CSS file and delete it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Repeat with the other CSS files you want to disable.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;by-using-polypane&#39;s-disable-css-option&quot; tabindex=&quot;-1&quot;&gt;By using Polypane&#39;s Disable CSS option &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/disable-all-css/#by-using-polypane&#39;s-disable-css-option&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Polypane, you can disable all CSS styles by using the &lt;strong&gt;Disable CSS&lt;/strong&gt; option:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In the pane where you want to disable CSS styles, open the &lt;strong&gt;Debug tools&lt;/strong&gt; menu.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Disable CSS&lt;/strong&gt; in the menu.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/disable-all-css-polypane.png&quot; alt=&quot;Polypane showing two panes. One has CSS applied and the other has CSS disabled. The pane with disabled CSS has an opened menu with the Disable CSS option highlighted&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find why a CSS property is overridden</title>
    <link href="https://devtoolstips.org/tips/en/find-why-css-property-is-overridden/"/>
    <updated>2024-04-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-why-css-property-is-overridden/</id>
    <content type="html">&lt;p&gt;In CSS, the &lt;strong&gt;cascade&lt;/strong&gt; plays a very important role in which CSS properties apply to an element. This key concept is not explained here, but you can learn more on MDN, at &lt;a href=&quot;https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance&quot;&gt;Cascade, specificity, and inheritance&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When debugging CSS, sometimes you realize that the CSS property you meant to apply to an element is actually overridden by another property. Finding the overriding property is not always easy, especially when the element is styled with many CSS rules that define many properties.&lt;/p&gt;
&lt;p&gt;Here are ways to find the overriding CSS property.&lt;/p&gt;
&lt;h3 id=&quot;by-using-the-computed-styles&quot; tabindex=&quot;-1&quot;&gt;By using the computed styles &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/find-why-css-property-is-overridden/#by-using-the-computed-styles&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Computed&lt;/strong&gt; styles panel in your browser DevTools. In Firefox, it&#39;s located in the &lt;strong&gt;Inspector&lt;/strong&gt; tool. In other browsers, it&#39;s in the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the property which is overridden.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Expand the property by clicking the triangle icon next to it.&lt;/p&gt;
&lt;p&gt;The list of CSS rules that define this property appears, ordered by their specificity. The rule that wins is at the top of the list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To navigate to the overriding property, click the link next to the winning rule.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;by-filtering-the-applied-rules&quot; tabindex=&quot;-1&quot;&gt;By filtering the applied rules &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/find-why-css-property-is-overridden/#by-filtering-the-applied-rules&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Firefox DevTools has a helpful feature that allows you to filter the applied CSS rules that are displayed in the &lt;strong&gt;Rules&lt;/strong&gt; panel. This can help you find the overriding property:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Locate the CSS property that is overridden in the &lt;strong&gt;Rules&lt;/strong&gt; panel of the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the &lt;strong&gt;Filter rules containing this property&lt;/strong&gt; icon (a funnel) next to the property name.&lt;/p&gt;
&lt;p&gt;The list of CSS rules is filtered to show only the rules that contain the overridden property. In addition, the property is highlighted everywhere it appears in the panel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Scroll through the list of properties to find the overriding property (i.e. the one that&#39;s not struck through).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can achieve the same result in other browsers by using the &lt;strong&gt;Filter&lt;/strong&gt; text box that&#39;s at the top of the &lt;strong&gt;Styles&lt;/strong&gt; panel in the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-why-css-property-is-overridden.png&quot; alt=&quot;Firefox DevTools, showing the Inspector tool and the Rules panel. The filter icon was clicked next to the display property, and the other display properties from other rules are highlighted.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>See the accessibility tree</title>
    <link href="https://devtoolstips.org/tips/en/see-accessibility-tree/"/>
    <updated>2024-03-05T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/see-accessibility-tree/</id>
    <content type="html">&lt;p&gt;The accessibility tree is a representation of the structure of a web page that is used by assistive technologies such as screen readers. It is similar to the DOM tree, but it only includes the elements that are relevant for accessibility. For example, it includes text nodes, links, images, or form controls, but not generic elements such as &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It&#39;s best to actually use a screen reader, or another assistive technology, to experience how your webpage is perceived by users with disabilities. But, it can sometimes be useful to see the accessibility tree in DevTools to understand how a page is structured.&lt;/p&gt;
&lt;h2 id=&quot;firefox&quot; tabindex=&quot;-1&quot;&gt;Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-accessibility-tree/#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firefox has a dedicated &lt;strong&gt;Accessibility&lt;/strong&gt; tool. To open it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press &lt;kbd&gt;F12&lt;/kbd&gt; to open DevTools.&lt;/li&gt;
&lt;li&gt;In the main toolbar, click the &lt;strong&gt;Accessibility&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Expand the &lt;strong&gt;document&lt;/strong&gt; node that&#39;s displayed in the tool to reveal the accessibility tree.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Supported features include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hovering over nodes in the tree highlights the corresponding DOM elements in the page.&lt;/li&gt;
&lt;li&gt;Selecting nodes reveals their accessibility properties in the sidebar.&lt;/li&gt;
&lt;li&gt;Accessibility issues are displayed next to the corresponding nodes in the tree.&lt;/li&gt;
&lt;li&gt;Checking for more issues, tabbing order, or simulating color vision deficiencies from the toolbar.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-accessibility-tree-firefox.png&quot; alt=&quot;The Accessibility tool in Firefox, showing the accessibility tree&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;chrome-and-edge&quot; tabindex=&quot;-1&quot;&gt;Chrome and Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-accessibility-tree/#chrome-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chrome and Edge have an option to display the accessibility tree in the &lt;strong&gt;Elements&lt;/strong&gt; tool, instead of the DOM tree. To enable it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press &lt;kbd&gt;F12&lt;/kbd&gt; to open DevTools.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Settings&lt;/strong&gt; panel by pressing &lt;kbd&gt;F1&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;In the sidebar, click &lt;strong&gt;Experiments&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Find the &lt;strong&gt;Enable full accessibility tree view in the Elements panel&lt;/strong&gt; checkbox and select it.&lt;/li&gt;
&lt;li&gt;Restart DevTools.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To see the accessibility tree in the &lt;strong&gt;Elements&lt;/strong&gt; tool:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Switch to Accessibility Tree View&lt;/strong&gt; in the top-right corner of the DOM tree.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Supported features include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hovering over nodes in the tree highlights the corresponding DOM elements in the page.&lt;/li&gt;
&lt;li&gt;Selecting nodes reveals the matching CSS styles in the &lt;strong&gt;Styles&lt;/strong&gt; pane and lets you update them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-accessibility-tree-edge.png&quot; alt=&quot;The Elements tool in Edge, showing the accessibility tree where the DOM tree normally is&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Name evaluated files with the sourceURL pragma</title>
    <link href="https://devtoolstips.org/tips/en/name-evaluated-files/"/>
    <updated>2024-01-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/name-evaluated-files/</id>
    <content type="html">&lt;p&gt;If you insert JavaScript code in a webpage by using the &lt;code&gt;eval()&lt;/code&gt; function, or inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags, you can use the &lt;code&gt;sourceURL&lt;/code&gt; pragma to give them a name in DevTools.&lt;/p&gt;
&lt;p&gt;For example, when using &lt;code&gt;eval()&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;console.log(&quot;Hello world!&quot;)\n//# sourceURL=hello-world.js&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above code snippet not only runs the evaluated code, but it also makes it appear in the &lt;strong&gt;Sources&lt;/strong&gt; (or &lt;strong&gt;Debugger&lt;/strong&gt;) tool as if it came from a file named &lt;code&gt;hello-world.js&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/name-evaluated-files.png&quot; alt=&quot;Firefox DevTools, the sourceURL pragma was used when evaluating some code in the Console, and a new file now appears in the Debugger tool, named after the string provided in the sourceURL pragma&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This can also be useful when using inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Hello world!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;//# sourceURL=hello-world.js&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using the &lt;code&gt;sourceURL&lt;/code&gt; pragma is a great way to debug your code more easily in DevTools. &lt;strong&gt;Console&lt;/strong&gt; messages will be easier to identify, and source code will be easier to debug.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Simulate the Window Controls Overlay feature for PWA</title>
    <link href="https://devtoolstips.org/tips/en/simulate-pwa-wco/"/>
    <updated>2024-01-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/simulate-pwa-wco/</id>
    <content type="html">&lt;p&gt;If you&#39;re building a desktop PWA, you might want to use the &lt;a href=&quot;https://developer.mozilla.org/docs/Web/API/Window_Controls_Overlay_API&quot;&gt;Window Controls Overlay&lt;/a&gt; (WCO) feature to make your app look more native. With WCO, you gain control over the entire surface area of the installed app window, and can display your own title bar.&lt;/p&gt;
&lt;p&gt;The only difficulty is testing the feature. To test your new title bar when using WCO, you actually need to install the app on your device first, but also test what the app looks like on all operating systems (macOS, Windows, Linux) because the title bar will look different on each.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Application&lt;/strong&gt; tool in both Chrome and Edge let you simulate the WCO feature so that you don&#39;t have to leave the comfort of your browser and can test what your app will look like when installed on any OS.&lt;/p&gt;
&lt;p&gt;To simulate WCO:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the PWA where you&#39;re using the WCO feature in Chrome or Edge.&lt;/li&gt;
&lt;li&gt;Open DevTools and go to the &lt;strong&gt;Application&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Manifest&lt;/strong&gt; tab in the sidebar.&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;Window Controls Overlay&lt;/strong&gt; section, at the bottom of the panel.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Emulate the Window Controls Overlay&lt;/strong&gt; checkbox.&lt;/li&gt;
&lt;li&gt;Select the operating system you want to simulate.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The OS-specific window controls will appear in the webpage, and your CSS code will work as if the &lt;code&gt;env(titlebar-area-*)&lt;/code&gt; environment variables were set. To learn more about the CSS environment variables you can use with WCO, see &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/env#using_env_to_ensure_content_is_not_obscured_by_window_control_buttons_in_desktop_pwas&quot;&gt;Using env() to ensure content is not obscured by window control buttons in desktop PWAs&lt;/a&gt; on MDN.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-pwa-wco.png&quot; alt=&quot;Edge, DevTools is opened, the Application tool shows the WCO section, and the WCO overlay is simulated in the page&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Inspect the user-agent DOM</title>
    <link href="https://devtoolstips.org/tips/en/inspect-user-agent-dom/"/>
    <updated>2024-01-19T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/inspect-user-agent-dom/</id>
    <content type="html">&lt;p&gt;Browsers often add elements to the DOM of your web pages on top of the ones you, yourself, defined. For example, when you create a &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; element, the browser creates a bunch of nested DOM nodes within it to display the controls, the progress bar, etc. When you use a &lt;code&gt;&amp;lt;input type=&amp;quot;range&amp;quot;&amp;gt;&lt;/code&gt; element, the browser also creates a nested DOM nodes to display the track and the thumb.&lt;/p&gt;
&lt;p&gt;This is called the user-agent DOM. It&#39;s called like this because it&#39;s the DOM that the user-agent (or browser) creates for you. It&#39;s not part of the HTML code of your webpage, and it&#39;s also not visible to you in DevTools by default or accessible via JavaScript. It is useful, however, to know that it exists, and sometimes it can be useful to inspect it.&lt;/p&gt;
&lt;p&gt;For example, in Chromium-based browsers, you can style the thumb in an &lt;code&gt;&amp;lt;input type=&amp;quot;range&amp;quot;&amp;gt;&lt;/code&gt; element using the &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/::-webkit-slider-thumb&quot;&gt;&lt;code&gt;::-webkit-slider-thumb&lt;/code&gt;&lt;/a&gt; pseudo-element. But by default, you can&#39;t inspect the thumb in DevTools.&lt;/p&gt;
&lt;p&gt;To display user-agent DOM nodes in DevTools, and therefore inspect and style it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open a new tab and type &lt;code&gt;about:config&lt;/code&gt; in the address bar.&lt;/li&gt;
&lt;li&gt;Search for &lt;code&gt;devtools.inspector.showAllAnonymousContent&lt;/code&gt; and set it to &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open DevTools, and open the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Select the element you want to inspect, for example an &lt;code&gt;&amp;lt;input type=&amp;quot;range&amp;quot;&amp;gt;&lt;/code&gt; element.&lt;/li&gt;
&lt;li&gt;Expand the element to inspect the DOM nodes generated by the browser for this element.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Safari, you don&#39;t need to enable anything to use this feature:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools, and open the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Select the element you want to inspect, for example an &lt;code&gt;&amp;lt;input type=&amp;quot;range&amp;quot;&amp;gt;&lt;/code&gt; element.&lt;/li&gt;
&lt;li&gt;Expand the element to reveal the &lt;strong&gt;Shadow root (user-agent)&lt;/strong&gt; node, and its children, that were generated by the browser for this element.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Chrome, Edge, or other Chromium-based browsers:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Settings&lt;/strong&gt; by pressing &lt;kbd&gt;F1&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Find the &lt;strong&gt;Show user agent shadow DOM&lt;/strong&gt; checkbox and select it.&lt;/li&gt;
&lt;li&gt;Close the &lt;strong&gt;Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Select the element you want to inspect, for example an &lt;code&gt;&amp;lt;input type=&amp;quot;range&amp;quot;&amp;gt;&lt;/code&gt; element.&lt;/li&gt;
&lt;li&gt;Expand the element to reveal the &lt;strong&gt;Shadow root (user-agent)&lt;/strong&gt; node, and its children, that were generated by the browser for this element.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/inspect-user-agent-dom.png&quot; alt=&quot;The Elements tool in Chrome, an input type=range is expanded, showing it&#39;s internal user-agent shadow dom&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Explain console errors by using artificial intelligence</title>
    <link href="https://devtoolstips.org/tips/en/explain-errors-with-ai/"/>
    <updated>2024-01-05T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/explain-errors-with-ai/</id>
    <content type="html">&lt;p&gt;Edge DevTools lets use the Microsoft Copilot AI assistant to explain errors and warnings in the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/p&gt;
&lt;p&gt;Console errors can sometimes be hard to understand and fix. The large language models that power modern AI assistants such as Microsoft Copilot are trained on so much data that they are sometimes able to reason about errors and provide helpful explanations.&lt;/p&gt;
&lt;p&gt;The Console in Edge DevTools is now linked to the Copilot AI assistant sidebar in Edge. To explain an error in Edge DevTools:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make sure you have the Copilot icon displayed in the top-right corner of Microsoft Edge. If not, go to &lt;strong&gt;Settings and more&lt;/strong&gt; (...) &amp;gt; &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Sidebar&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copilot&lt;/strong&gt; to enable it.&lt;/li&gt;
&lt;li&gt;Make sure you&#39;re sign-in to Microsoft Edge with your personal Microsoft account.&lt;/li&gt;
&lt;li&gt;Find the error you&#39;re interested in in the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;ask Copilot: &amp;quot;Explain this error&amp;quot;&lt;/strong&gt; button next to the error message.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The Copilot sidebar appears, your message is sent to the AI assistant, and you get a response that, hopefully, helps you understand the error.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/explain-errors-with-ai.png&quot; alt=&quot;Edge with DevTools opened, an error was clicked, and Copilot is in the Edge sidebar, showing the error message and the explanation&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To learn more, see &lt;a href=&quot;https://learn.microsoft.com/microsoft-edge/devtools-guide-chromium/experimental-features/copilot-explain&quot;&gt;Explain DevTools Console errors and source code using Copilot in Edge&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Enable DevTools in Safari</title>
    <link href="https://devtoolstips.org/tips/en/enable-safari-devtools/"/>
    <updated>2023-12-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/enable-safari-devtools/</id>
    <content type="html">&lt;p&gt;Unlike other browsers, Safari hides its DevTools (and other developer-related features) by default. That&#39;s actually good because 99% of the people using the browser are probably not web developers.&lt;/p&gt;
&lt;p&gt;If you are a web developer, though, and you want to use the DevTools in Safari, here&#39;s how to enable the option:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to Safari&#39;s &lt;strong&gt;Settings&lt;/strong&gt; or press &lt;code&gt;Cmd+,&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go to the Advanced tab.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check the &lt;strong&gt;Show features for web developers&lt;/strong&gt; option.&lt;/p&gt;
&lt;p&gt;This will add the &lt;strong&gt;Develop&lt;/strong&gt; menu in the menu bar and the &lt;strong&gt;Develop&lt;/strong&gt; tab in Settings. Use this menu to open DevTools and access other developer-related features.&lt;/p&gt;
&lt;p&gt;The right-click &amp;gt; &lt;strong&gt;Inspect Element&lt;/strong&gt; option will also now be available.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/enable-safari-devtools.png&quot; alt=&quot;Safari&#39;s Preferences, the Advanced tab shows the Show Developer menu in menu bar option&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Block DevTools</title>
    <link href="https://devtoolstips.org/tips/en/block-devtools/"/>
    <updated>2023-12-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/block-devtools/</id>
    <content type="html">&lt;p&gt;There are two levels to consider when talking about blocking (or disabling) DevTools in a browser:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Disabling DevTools at the browser level. For example, if you have a browser for web development, and another one for personal browsing, you may want to disable DevTools in the latter. Maybe because you don&#39;t want &lt;kbd&gt;F12&lt;/kbd&gt; to open DevTools. Or maybe it&#39;s your mum&#39;s browser and she always gets confused when she accidentally opens DevTools.&lt;/li&gt;
&lt;li&gt;Disabling DevTools for an entire organization. For example, you&#39;re a teacher and you don&#39;t want your students to be able to use DevTools. Or your an IT admin and you want to disable DevTools for all the computers in your company.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All browsers have different ways to disable DevTools. Here are the ones we currently know about. If you know of others, please &lt;a href=&quot;https://github.com/captainbrosset/devtools-tips&quot;&gt;let us know on the DevTools Tips GitHub repo&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Firefox&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can disable the &lt;kbd&gt;F12&lt;/kbd&gt; keyboard shortcut by going to &lt;code&gt;about:config&lt;/code&gt;, searching for the &lt;code&gt;devtools.f12_enabled&lt;/code&gt; setting, and setting it to &lt;code&gt;false&lt;/code&gt;. Other DevTools shortcuts are still enabled by default though.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/block-devtools.png&quot; alt=&quot;Disabling F12 in Firefox&#39;s about:config page&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can disable DevTools for your organization by using the &lt;a href=&quot;https://mozilla.github.io/policy-templates/#disabledevelopertools&quot;&gt;&lt;code&gt;DisableDeveloperTools&lt;/code&gt; policy&lt;/a&gt;. Learn more about &lt;a href=&quot;https://support.mozilla.org/products/firefox-enterprise/policies-customization-enterprise/policies-overview-enterprise&quot;&gt;policies in Firefox&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Edge&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Edge, the &lt;kbd&gt;F12&lt;/kbd&gt; keyboard is already disabled by default. The first time you press it, a confirmation dialog appears, and you can choose to either open DevTools, or continue blocking the shortcut. You can also ask Edge to remember your decision so you never have to see the dialog again. Other DevTools shortcuts are still enabled by default though.&lt;/li&gt;
&lt;li&gt;You can disable DevTools for your organization by using the &lt;a href=&quot;https://learn.microsoft.com/deployedge/microsoft-edge-policies#developertoolsavailability&quot;&gt;&lt;code&gt;DeveloperToolsAvailability&lt;/code&gt; policy&lt;/a&gt;. Learn more about &lt;a href=&quot;https://learn.microsoft.com/deployedge/microsoft-edge-policies&quot;&gt;policies in Edge&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Chrome&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can disable DevTools for your organization by using the &lt;a href=&quot;https://chromeenterprise.google/policies/#DeveloperToolsAvailability&quot;&gt;&lt;code&gt;DeveloperToolsAvailability&lt;/code&gt; policy&lt;/a&gt;. Learn more about &lt;a href=&quot;https://chromeenterprise.google/policies/&quot;&gt;policies in Chrome&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Safari&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Safari, DevTools (or &lt;em&gt;Web Inspector&lt;/em&gt; as it&#39;s called there) is disabled by default. You can enable it in the Advanced tab of the Preferences. See &lt;a href=&quot;https://devtoolstips.org/tips/en/block-devtools/enable-safari-devtools.md&quot;&gt;Enable DevTools in Safari&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>List all event listeners on the entire page</title>
    <link href="https://devtoolstips.org/tips/en/list-all-event-listeners/"/>
    <updated>2023-11-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/list-all-event-listeners/</id>
    <content type="html">&lt;p&gt;When you don&#39;t know a codebase, it might be hard to know where to get started, and what events are being listened to by which elements.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Console&lt;/strong&gt; tool, in Chromium-based browsers, comes with a nice utility function named &lt;code&gt;getEventListeners&lt;/code&gt; which returns all of the listeners attached to a given element. If we combine this with the &lt;code&gt;$$&lt;/code&gt; utility function, we can get a list of all elements on the page, and their listeners.&lt;/p&gt;
&lt;p&gt;The following code snippet will return an array of objects, each containing an element and its listeners. It also filters out all of the elements that don&#39;t have any listeners attached to them.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token function&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; el&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; listeners&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;getEventListeners&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;el&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; Object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;listeners&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, to list all elements that have listeners on a page:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Console&lt;/strong&gt; tool, by pressing &lt;kbd&gt;Ctrl+Shift+J&lt;/kbd&gt; on Windows or Linux, or &lt;kbd&gt;Command+Option+J&lt;/kbd&gt; on macOS.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Paste the code snippet above in the &lt;strong&gt;Console&lt;/strong&gt;, and press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The list of all elements with listeners is displayed in the &lt;strong&gt;Console&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/list-all-event-listeners.png&quot; alt=&quot;Chrome, with the devtoolstips.org website loaded, and the DevTools Console on the side, showing the result of the above script&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Debug popups that appear on hover</title>
    <link href="https://devtoolstips.org/tips/en/debug-popups-on-hover/"/>
    <updated>2023-11-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-popups-on-hover/</id>
    <content type="html">&lt;p&gt;As described in &lt;a href=&quot;https://devtoolstips.org/tips/en/debug-popups-on-hover/debug-js-hover.md&quot;&gt;Debug popups that appear on hover using JS&lt;/a&gt; and in &lt;a href=&quot;https://devtoolstips.org/tips/en/debug-popups-on-hover/debug-js-hover-2.md&quot;&gt;Debug popups that appear on hover using the debugger statement&lt;/a&gt;, there are ways to debug popups that appear on hover using JavaScript.&lt;/p&gt;
&lt;p&gt;The main problem in debugging overlay elements, like popups, is that they disappear as soon as the page loses focus, for example after moving focus to the DevTools window. Use the techniques below to keep focus on the webpage while using DevTools.&lt;/p&gt;
&lt;h2 id=&quot;in-chrome-or-edge&quot; tabindex=&quot;-1&quot;&gt;In Chrome or Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-popups-on-hover/#in-chrome-or-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chromium-based browsers, such as Chrome and Edge, provide a way to emulate a focused state on the webpage even if DevTools has focus.&lt;/p&gt;
&lt;p&gt;To emulate a focused state on the webpage:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Command Menu&lt;/strong&gt; (&lt;code&gt;Cmd+Shift+P&lt;/code&gt; or &lt;code&gt;Ctrl+Shift+P&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Type &lt;strong&gt;rendering&lt;/strong&gt; and select the &lt;strong&gt;Show Rendering&lt;/strong&gt; command. The &lt;strong&gt;Rendering&lt;/strong&gt; tool appears at the bottom of DevTools.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Rendering&lt;/strong&gt; tool, scroll down and check the &lt;strong&gt;Emulate a focused page&lt;/strong&gt; option. The webpage now has focus.&lt;/li&gt;
&lt;li&gt;Use DevTools to inspect and debug elements that only appear when focus is in the webpage.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-popups-on-hover.png&quot; alt=&quot;The Rendering tool in DevTools, showing the Emulate a focused page option&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-polypane&quot; tabindex=&quot;-1&quot;&gt;In Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-popups-on-hover/#in-polypane&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Polypane provides a way to retain the focus state inside each pane. To retain the focus:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right-click on the &lt;strong&gt;Sync&lt;/strong&gt; icon in the toolbar.&lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;Focus&lt;/strong&gt; option. The focus in now retained in all panes, and also kept in sync across all panes.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-popups-on-hover-polypane.png&quot; alt=&quot;Polypane with an opened context menu on the sync button, and the &#39;Focus&#39; option checked and highlighted&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Force execution, skipping breakpoints, when paused</title>
    <link href="https://devtoolstips.org/tips/en/force-execution-at-breakpoint/"/>
    <updated>2023-10-26T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/force-execution-at-breakpoint/</id>
    <content type="html">&lt;p&gt;When using breakpoints to debug your JavaScript code, sometimes you end up setting many breakpoints in different functions. You might want to keep these breakpoints but not always pause at them.&lt;/p&gt;
&lt;p&gt;There are two ways to do this in DevTools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Forcing execution, skipping over other breakpoints.&lt;/li&gt;
&lt;li&gt;Or temporarily deactivating breakpoints.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;force-execution&quot; tabindex=&quot;-1&quot;&gt;Force execution &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/force-execution-at-breakpoint/#force-execution&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Forcing execution is only supported in Chrome and Edge:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Sources&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Set all of the breakpoints that you need.&lt;/li&gt;
&lt;li&gt;Once paused at your first breakpoint, click and hold the &lt;strong&gt;Resume script execution&lt;/strong&gt; button and then select the &lt;strong&gt;Force script execution&lt;/strong&gt; button. The script execution resumes, and doesn&#39;t pause at any other breakpoint.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/force-execution-at-breakpoint-edge.png&quot; alt=&quot;The Sources tool in Edge, showing the Force script execution button&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;temporarily-deactivate-breakpoints&quot; tabindex=&quot;-1&quot;&gt;Temporarily deactivate breakpoints &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/force-execution-at-breakpoint/#temporarily-deactivate-breakpoints&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Chrome, Edge, and Firefox, you can temporarily deactivate breakpoints:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Sources&lt;/strong&gt; tool in Chrome or Edge, or the &lt;strong&gt;Debugger&lt;/strong&gt; tool in Firefox.&lt;/li&gt;
&lt;li&gt;Set all of the breakpoints that you need.&lt;/li&gt;
&lt;li&gt;Once paused at your first breakpoint, click the &lt;strong&gt;Deactivate breakpoints&lt;/strong&gt; button, and then click &lt;strong&gt;Resume&lt;/strong&gt;. The script execution resumes, and doesn&#39;t pause at any other breakpoint.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/force-execution-at-breakpoint-firefox.png&quot; alt=&quot;The Debugger tool in Firefox, showing the Deactive breakpoints button&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>See the viewport size</title>
    <link href="https://devtoolstips.org/tips/en/see-viewport-size/"/>
    <updated>2023-10-05T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/see-viewport-size/</id>
    <content type="html">&lt;p&gt;The size of the viewport that&#39;s used to render a webpage in a browser can be very important at times, such as when creating or debugging &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/CSS_media_queries/Using_media_queries&quot;&gt;media queries&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can easily know what the current size of the viewport is in DevTools. Here are two ways to do it.&lt;/p&gt;
&lt;h2 id=&quot;see-the-viewport-size-in-the-console&quot; tabindex=&quot;-1&quot;&gt;See the viewport size in the Console &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-viewport-size/#see-the-viewport-size-in-the-console&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To display the viewport size in the &lt;strong&gt;Console&lt;/strong&gt; tool:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Console&lt;/strong&gt; tool in DevTools.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;${document.documentElement.clientWidth} x ${document.documentElement.clientHeight}&lt;/code&gt; in the prompt and press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;br /&gt;
The size of the viewport, at the time you executed the expression, appears in the &lt;strong&gt;Console&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can also use a &lt;em&gt;live expression&lt;/em&gt; to see the size of the viewport in real-time, as you resize the browser window. To learn more, see &lt;a href=&quot;https://devtoolstips.org/tips/en/see-viewport-size/live-expressions.md&quot;&gt;Cut down on console noise using live expressions&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;see-the-viewport-size-in-the-page&quot; tabindex=&quot;-1&quot;&gt;See the viewport size in the page &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-viewport-size/#see-the-viewport-size-in-the-page&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can also see the size of the viewport⁕ in the page directly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Chrome or Edge:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Focus your attention in the top-right corner of the webpage, and then resize the browser window (or the DevTools panel).&lt;br /&gt;
The viewport size appears as a temporary overlay, in the top-right corner of the webpage:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-viewport-size-chrome.png&quot; alt=&quot;Chrome, with DevTools opened, the viewport size overlay appears in the rendered webpage&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools and go to the &lt;strong&gt;Settings&lt;/strong&gt; panel (&lt;kbd&gt;F1&lt;/kbd&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under &lt;strong&gt;Available Toolbox Buttons&lt;/strong&gt;, select the &lt;strong&gt;Toggle rulers for the page&lt;/strong&gt; setting.&lt;br /&gt;
The &lt;strong&gt;Toggle rulers for the page&lt;/strong&gt; icon appears in the DevTools toolbar.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the ruler icon to display rulers in the webpage.&lt;br /&gt;
In addition to the top and left rulers which now are visible in the webpage, the viewport size is displayed in an overlay, in the top-right corner of the webpage.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-viewport-size-firefox.png&quot; alt=&quot;Firefox, with DevTools opened, the viewport size overlay appears in the rendered webpage&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Safari:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open Web Inspector and go to the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Hover over any node displayed in the DOM tree of the tool.&lt;br /&gt;
On hover, rulers and the viewport size appear in the page temporarily.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can also click the &lt;strong&gt;Show rulers&lt;/strong&gt; icon in the toolbar of the &lt;strong&gt;Elements&lt;/strong&gt; tool to make the rulers and viewport size overlay permanent.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-viewport-size-safari.png&quot; alt=&quot;Safari, with Inspector opened, the viewport size overlay appears in the rendered webpage&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The dimensions of each viewport are always shown above it. Edit these values to update the viewport.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-viewport-size-polypane.png&quot; alt=&quot;Polypane, showing dimensions above each viewport&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;⁕ In browsers with classic scrollbars, the number shown in the page by DevTools doesn&#39;t account for the scrollbar width, if there is one. The actual viewport width is about 15 to 17 pixels small than the number shown.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Convert images to data-urls</title>
    <link href="https://devtoolstips.org/tips/en/convert-image-to-data-url/"/>
    <updated>2023-10-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/convert-image-to-data-url/</id>
    <content type="html">&lt;p&gt;A data URL is a URL that starts with the prefix &lt;code&gt;data:&lt;/code&gt; instead of &lt;code&gt;http:&lt;/code&gt; or &lt;code&gt;https:&lt;/code&gt;. This data prefix (or scheme) allows you to embed the actual content of the resource in the URL itself, rather than linking to it. For example &lt;code&gt;data:text/html,&amp;lt;h1&amp;gt;Hello world&amp;lt;/h1&amp;gt;&lt;/code&gt; is a data URL that contains HTML content directly. Try it out in a browser tab!&lt;/p&gt;
&lt;p&gt;Images can also be encoded as data URLs. Here is a 2x2 pixel solid red PNG image as a data URL: &lt;code&gt;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEklEQVQIW2P8z8AARAwMjDAGACwBA/+8RVWvAAAAAElFTkSuQmCC&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It can sometimes be useful to convert images to their data URLs, for example when you want to embed the images in a standalone HTML document that doesn&#39;t make any server requests.&lt;/p&gt;
&lt;p&gt;To convert any image to a data URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the image you want to convert in a new tab. Or open the webpage that contains the image you want to convert in a tab.&lt;/li&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Find the image you want to convert in the DOM tree and right-click it.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Copy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Image Data-URL&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Chrome or Edge:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the image you want to convert in a new tab. Or open the webpage that contains the image you want to convert in a tab.&lt;/li&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Find the image you want to convert in the list of requests and click it.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Preview&lt;/strong&gt; tab in the sidebar.&lt;/li&gt;
&lt;li&gt;Right-click on the image preview and select &lt;strong&gt;Copy image as data URI&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right-click on the image you want to convert.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Copy...&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copy as data URI&lt;/strong&gt;. Other options include coping as an IMG tag, copying as markdown and as CSS background-image.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/convert-image-to-data-url.png&quot; alt=&quot;The Network tool in Edge, an image is selected, the Preview tab is open, and the right-click menu shows the copy image as data URI item&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Use user gesture restricted APIs in the Console</title>
    <link href="https://devtoolstips.org/tips/en/emulate-user-gesture-in-console/"/>
    <updated>2023-09-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/emulate-user-gesture-in-console/</id>
    <content type="html">&lt;p&gt;Certain web APIs are &lt;em&gt;user gesture&lt;/em&gt; restricted. This means that they can only be called as a result of a user action, such as in a click event handler.&lt;/p&gt;
&lt;p&gt;For example, you can&#39;t simply put yout website in fullscreen mode by using &lt;code&gt;document.body.requestFullscreen()&lt;/code&gt; in your JavaScript code. You&#39;re only allowed to do this if the user initiated the action. This is for security reasons and is all well and good.&lt;/p&gt;
&lt;p&gt;However, it can be a pain when you need to test a user gesture restricted API in the &lt;strong&gt;Console&lt;/strong&gt; tool of DevTools.&lt;/p&gt;
&lt;p&gt;Thankfully, Chrome, Edge, and Safari let you do it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Chrome or Edge, this is done by default. All JavaScript code you run in the &lt;strong&gt;Console&lt;/strong&gt; is treated as a user action. You can, however disable this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Console Settings&lt;/strong&gt; button in the top-right corner of the tool.&lt;/li&gt;
&lt;li&gt;Clear the &lt;strong&gt;Treat code evaluation as user action&lt;/strong&gt; setting.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Safari:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;Emulate User Gesture&lt;/strong&gt; setting in the toolbar.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-user-gesture-in-console.png&quot; alt=&quot;Safari WebInspector, showing the Console tool, and the user gesture checkbox&quot; /&gt;&lt;/p&gt;
&lt;p&gt;And that&#39;s it! You can now use and test any APIs in the &lt;strong&gt;Console&lt;/strong&gt;, including those that normally require a user gesture.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find the offset parent of an element</title>
    <link href="https://devtoolstips.org/tips/en/find-the-offset-parent-of-an-element/"/>
    <updated>2023-09-13T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-the-offset-parent-of-an-element/</id>
    <content type="html">&lt;p&gt;To know what an element is offset against horizontally or vertically (Which you do with &lt;code&gt;position:relative&lt;/code&gt; and a &lt;code&gt;left&lt;/code&gt;, &lt;code&gt;top&lt;/code&gt; or &lt;code&gt;inset&lt;/code&gt; value) you need to know its &lt;strong&gt;offset parent&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The offset parent of an element is the closest ancestor that has a position other than &lt;code&gt;static&lt;/code&gt;, or the root element if none of the ancestors have positioning. Learn more about &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent&quot;&gt;offset parents on MDN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To find the offset parent of an element in Polypane:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Inspect the element in the &lt;strong&gt;Elements&lt;/strong&gt; panel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Debug&lt;/strong&gt; tab, and then scroll down to the &lt;strong&gt;Context&lt;/strong&gt; section.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Offset parent&lt;/strong&gt; sub-section is listed there:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-the-offset-parent-of-an-element.png&quot; alt=&quot;Polypane showing an inspected element with the Debug tab open. The Offset parent entry is highlighted.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  
  <entry>
    <title>Highlight all elements on the page that match a given CSS selector</title>
    <link href="https://devtoolstips.org/tips/en/highlight-elements-from-selector/"/>
    <updated>2023-09-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/highlight-elements-from-selector/</id>
    <content type="html">&lt;p&gt;When you select an element in DevTools (in the &lt;strong&gt;Elements&lt;/strong&gt; or &lt;strong&gt;Inspector&lt;/strong&gt; tool), you see the CSS rules that apply to it. But, these rules can also apply to other elements in the page than the currently selected one.&lt;/p&gt;
&lt;p&gt;To see all the elements that match a given CSS rule selector, and therefore know which elements will be impacted if you change that rule:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Firefox, select an element in the &lt;strong&gt;Inspector&lt;/strong&gt; tool, then click the &lt;strong&gt;Highlight all elements matching this selector&lt;/strong&gt; button next to a CSS rule in the &lt;strong&gt;Styles&lt;/strong&gt; pane:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/highlight-elements-from-selector-firefox.png&quot; alt=&quot;Firefox, with a webpage showing 3 highlighted elements, and the button enabled in the Styles pane&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Chrome, Edge, or Safari, select an element in the &lt;strong&gt;Elements&lt;/strong&gt; tool, then hover over a CSS selector in the &lt;strong&gt;Styles&lt;/strong&gt; pane:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/highlight-elements-from-selector-edge.png&quot; alt=&quot;Edge, with a webpage showing 3 highlighted elements, and a CSS selector hovered in the Styles pane&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Polypane, select an element in the &lt;strong&gt;Elements&lt;/strong&gt; panel, then click the &lt;strong&gt;Highlight all elements matching this selector&lt;/strong&gt; button next to a CSS rule in the &lt;strong&gt;Styles&lt;/strong&gt; tab:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/highlight-elements-from-selector-polypane.png&quot; alt=&quot;Polypane, with three panes showing a website. in each pane there is a highlighted element. There is a button enabled in the Styles tab&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Check if a website uses third-party cookies</title>
    <link href="https://devtoolstips.org/tips/en/detect-3p-cookies/"/>
    <updated>2023-08-31T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/detect-3p-cookies/</id>
    <content type="html">&lt;p&gt;Cookies are small files that websites save on your computer when you visit them. Websites often use cookies to remember things about your last visit. For example, a weather website can use cookies to store your preferred location, so you don’t have to enter it every time.&lt;/p&gt;
&lt;p&gt;Third-party cookies are just cookies too, but they are created by websites other than the one you are visiting, for example when the website you are visiting embeds an advertisement iframe.&lt;/p&gt;
&lt;p&gt;Third-party cookies are often used by advertisers to keep track of the websites a user visits, collect information about their browsing activity, with the hope of offering targeted ads and getting them to return to a website to buy products.&lt;/p&gt;
&lt;p&gt;There are very legitimate uses for third-party cookies and personalized content, but they also pose significant privacy and security concerns.&lt;/p&gt;
&lt;p&gt;With DevTools, you can detect if a website uses third-party cookies:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to the website you want to test in a new window or tab.&lt;/li&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Application&lt;/strong&gt; tool in Chromium-based browsers, or the &lt;strong&gt;Storage&lt;/strong&gt; tool in Firefox or Safari.&lt;/li&gt;
&lt;li&gt;In the sidebar, expand the &lt;strong&gt;Cookies&lt;/strong&gt; section.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A list appears in the &lt;strong&gt;Cookies&lt;/strong&gt; section. Check the list to see if the website uses third-party cookies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the website doesn&#39;t use cookies, the list will be empty.&lt;/li&gt;
&lt;li&gt;If the website uses its own (first-party) cookies, you will see one item which matches the website&#39;s URL.&lt;/li&gt;
&lt;li&gt;If the website uses third-party cookies, you will see more items in the list, some being from third-party websites that may just be tracking you.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/detect-3p-cookies.png&quot; alt=&quot;Chrome DevTools&#39; Application tool, showing the cookies section containing a bunch of third-party websites&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Customize the way objects look in DevTools</title>
    <link href="https://devtoolstips.org/tips/en/custom-object-formatters/"/>
    <updated>2023-08-23T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/custom-object-formatters/</id>
    <content type="html">&lt;p&gt;Objects appear in many places in DevTools. Most commonly in the &lt;strong&gt;Console&lt;/strong&gt; tool, but also in various parts of the &lt;strong&gt;Sources&lt;/strong&gt; (or &lt;strong&gt;Debugger&lt;/strong&gt;) tool when you debug JavaScript code.&lt;/p&gt;
&lt;p&gt;DevTools is the one that decides how these objects appear in the UI. For example, string and numbers have different colors, arrays have a little preview of the items, and an icon that lets you expand them to see the full list of items, etc.&lt;/p&gt;
&lt;p&gt;But DevTools also lets you customize the way objects are displayed by using &lt;em&gt;Custom Object Formatters&lt;/em&gt;. This can be very useful when you&#39;re working with a framework that stores objects in a particular way, and you want to make it easier to inspect these objects, or just to make certain types of objects stand out more.&lt;/p&gt;
&lt;p&gt;Custom Object Formatters isn&#39;t something you configure in DevTools. Instead, you define them in the code that runs on the webpage, and DevTools picks them up automatically.&lt;/p&gt;
&lt;p&gt;To create a new formatter:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a new object with three properties: &lt;code&gt;header&lt;/code&gt;, &lt;code&gt;hasBody&lt;/code&gt;, and &lt;code&gt;body&lt;/code&gt;. All three properties should be functions that receive an &lt;code&gt;object&lt;/code&gt; parameter, the object that DevTools wants to display. The &lt;code&gt;header&lt;/code&gt; function should return the preview of the object, in &lt;a href=&quot;http://www.jsonml.org/&quot;&gt;JsonML format&lt;/a&gt;. &lt;code&gt;hasBody&lt;/code&gt; should return a boolean that tells DevTools whether the object can be expanded to display more information. And &lt;code&gt;body&lt;/code&gt; should return the preview of the object when it&#39;s expanded, also in JsonML format. For example:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; myCoolFormatter &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;token function-variable function&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;object &lt;span class=&quot;token keyword&quot;&gt;instanceof&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ColorCombo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;div&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;style&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;background-color: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color1&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;; color: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color2&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;; font-weight: bold; padding: .25rem;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;ColorCombo&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;token function-variable function&quot;&gt;hasBody&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; object &lt;span class=&quot;token keyword&quot;&gt;instanceof&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ColorCombo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;token function-variable function&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;object &lt;span class=&quot;token keyword&quot;&gt;instanceof&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ColorCombo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;ol&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br /&gt;            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;li&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br /&gt;              &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;Color 1 (&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color1&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;): &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;              &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;span&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;style&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;display: inline-block; width: 1rem; height: 1rem; border-radius: 50%; background-color: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color1&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;li&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;br /&gt;              &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;Color 2 (&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color2&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;): &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;              &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;span&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;style&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;display: inline-block; width: 1rem; height: 1rem; border-radius: 50%; background-color: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color2&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;          &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above code snippet defines a custom formatter that will be used for objects that are instances of the &lt;code&gt;ColorCombo&lt;/code&gt; class. Let&#39;s imagine this class is used on your webpage and is defined as follows:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ColorCombo&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;color1&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; color2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; color1&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;color2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; color2&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Append your formatter object to the global &lt;code&gt;window.devtoolsFormatters&lt;/code&gt; array:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// You can create a new array.&lt;/span&gt;&lt;br /&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;devtoolsFormatters &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;myCoolFormatter&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;// Or append to the list of existing formatters.&lt;/span&gt;&lt;br /&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;devtoolsFormatters&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;myCoolFormatter&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&#39;s it, you don&#39;t need to do anything more. Now, whenever &lt;code&gt;ColorCombo&lt;/code&gt; objects are displayed in DevTools (for example when using &lt;code&gt;console.log(object)&lt;/code&gt;), they will be displayed using the custom formatter you defined.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/custom-object-formatters.png&quot; alt=&quot;Example of how a ColorCombo object looks in the Console tool of Chrome DevTools&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Learn more:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://fxdx.dev/firefox-devtools-custom-object-formatters/&quot;&gt;Firefox DevTools Custom Object Formatters&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://bit.ly/object-formatters&quot;&gt;Custom Object Formatters in Chrome DevTools&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/disjukr/vector-devtools&quot;&gt;Vector-devtools&lt;/a&gt;, a cool formatter for 2D vector objects.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Inspect DevTools with DevTools</title>
    <link href="https://devtoolstips.org/tips/en/inspect-devtools-with-devtools/"/>
    <updated>2023-07-31T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/inspect-devtools-with-devtools/</id>
    <content type="html">&lt;p&gt;The user interface of DevTools is built with HTML, CSS, and JavaScript. This means you can inspect and debug DevTools with DevTools.&lt;/p&gt;
&lt;h2 id=&quot;chromium&quot; tabindex=&quot;-1&quot;&gt;Chromium &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/inspect-devtools-with-devtools/#chromium&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To debug DevTools in Chromium-based browsers, such as Chrome or Edge:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools on any browser tab.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Undock DevTools into a separate window.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Press &lt;kbd&gt;Ctrl+Shift+I&lt;/kbd&gt; (&lt;kbd&gt;Cmd+Opt+I&lt;/kbd&gt; on macOS) to open a second DevTools window.&lt;/p&gt;
&lt;p&gt;This second DevTools window now targets the first one. Anything you see in the &lt;strong&gt;Elements&lt;/strong&gt; tool represents elements of the first DevTools window&#39;s user interface.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/inspect-devtools-with-devtools-chrome.png&quot; alt=&quot;Two Chrome DevTools windows, the first one inspects a webpage, the second one inspects the first one&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;firefox&quot; tabindex=&quot;-1&quot;&gt;Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/inspect-devtools-with-devtools/#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To debug DevTools in Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools on any browser tab.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Settings&lt;/strong&gt; page by pressing &lt;kbd&gt;F1&lt;/kbd&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under &lt;strong&gt;Advanced settings&lt;/strong&gt;, check the &lt;strong&gt;Enable browser chrome and add-on debugging toolboxes&lt;/strong&gt; and &lt;strong&gt;Enable remote debugging&lt;/strong&gt; checkboxes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now in the main Firefox toolbar, click &lt;strong&gt;Open application menu&lt;/strong&gt; (the hamburger menu).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;More tools&lt;/strong&gt; &amp;gt; &lt;strong&gt;Browser Toolbox&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;A new DevTools window appears. This one inspects the entire Firefox browser window. The elements you see in the &lt;strong&gt;Inspector&lt;/strong&gt; tool represent elements of the Firefox user interface, including its DevTools.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/inspect-devtools-with-devtools-firefox.png&quot; alt=&quot;Firefox with DevTools opened, and another DevTools window next to it which debugs the Firefox window&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  
  <entry>
    <title>Create your own DevTools theme</title>
    <link href="https://devtoolstips.org/tips/en/create-your-own-devtools-theme/"/>
    <updated>2023-07-31T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/create-your-own-devtools-theme/</id>
    <content type="html">&lt;p&gt;You can change the color theme of DevTools to match your preference (see &lt;a href=&quot;https://devtoolstips.org/tips/en/create-your-own-devtools-theme/change-color-theme.md&quot;&gt;Change the color theme of DevTools&lt;/a&gt; to learn more), but you can also create your own theme from scratch by creating a browser extension.&lt;/p&gt;
&lt;p&gt;The process is a little bit complicated, and you will need to keep up with any DevTools changes that may break your custom styles, but it&#39;s a great way to make DevTools your own. And by creating it as an extension, it also means you can share it with others.&lt;/p&gt;
&lt;h2 id=&quot;create-an-extension&quot; tabindex=&quot;-1&quot;&gt;Create an extension &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/create-your-own-devtools-theme/#create-an-extension&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First, you need to create a browser extension that will load your custom styles in DevTools. This extension is different from traditional browser extensions in that it doesn&#39;t create any new UI element in the browser.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a directory for your extension.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In your extension directory, create a &lt;code&gt;devtools.html&lt;/code&gt; file which is only used to load a JavaScript file:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;devtools.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Also create the &lt;code&gt;devtools.js&lt;/code&gt; file. This is where you&#39;ll load the custom styles:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;chrome&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;runtime&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getURL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;devtools.css&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  response&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    chrome&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;devtools&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;panels&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;applyStyleSheet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;text&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now, create the &lt;code&gt;devtools.css&lt;/code&gt; file. This is where you&#39;ll write your custom styles. For example:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.webkit-html-attribute-name&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; bold&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; black&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To help you get started with which styles you can override in your custom stylesheet, see &lt;a href=&quot;https://devtoolstips.org/tips/en/create-your-own-devtools-theme/inspect-devtools-with-devtools.md&quot;&gt;Inspect DevTools with DevTools&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally, create a &lt;code&gt;manifest.json&lt;/code&gt; file to load the DevTools page:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;My DevTools theme&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;manifest_version&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;devtools_page&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;devtools.html&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;enable-custom-devtools-themes&quot; tabindex=&quot;-1&quot;&gt;Enable custom DevTools themes &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/create-your-own-devtools-theme/#enable-custom-devtools-themes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By default, DevTools doesn&#39;t load custom themes created by browser extensions. To enable this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Settings&lt;/strong&gt; page by pressing &lt;kbd&gt;F1&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;In the sidebar, click &lt;strong&gt;Experiments&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;Allow extensions to load custom stylesheets&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Close the &lt;strong&gt;Settings&lt;/strong&gt; page and reload DevTools.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;load-your-extension&quot; tabindex=&quot;-1&quot;&gt;Load your extension &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/create-your-own-devtools-theme/#load-your-extension&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To test locally, you can load your extension as an unpacked extension:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;about:extensions&lt;/code&gt; page in Chrome or Edge.&lt;/li&gt;
&lt;li&gt;Enable the &lt;strong&gt;Developer mode&lt;/strong&gt; toggle.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Load unpacked&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Browse to your extension&#39;s directory and select this folder.&lt;/li&gt;
&lt;li&gt;Open a new tab on any website and open DevTools.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here is what the example code above looks like in Chrome DevTools:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/create-your-own-devtools-theme.png&quot; alt=&quot;Chrome DevTools showing a custom theme where attribute names in the Elements tool are bolded&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find memory leaks by comparing heap snapshots</title>
    <link href="https://devtoolstips.org/tips/en/find-memory-leaks/"/>
    <updated>2023-07-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-memory-leaks/</id>
    <content type="html">&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you think your memory leak comes from DOM nodes, you can also use the  &lt;strong&gt;Detached Elements&lt;/strong&gt; tool in Edge, see &lt;a href=&quot;https://devtoolstips.org/tips/en/find-memory-leaks/get-detached-elements.md&quot;&gt;Get detached DOM elements to investigate memory leaks&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Memory leaks are hard to find, and the &lt;strong&gt;Memory&lt;/strong&gt; tool in DevTools can look pretty intimidating. But if you can reproduce the leak consistently, it helps to know about the tool&#39;s &lt;em&gt;Compare&lt;/em&gt; feature, which allows you to focus on just the differences between two heap snapshots and forget the rest.&lt;/p&gt;
&lt;p&gt;To compare two heap snapshots:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In Chrome or Edge DevTools, open the &lt;strong&gt;Memory&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Before doing anything else, record a first heap snapshot. This will be your baseline against which you&#39;ll compare all other snapshots.&lt;/p&gt;
&lt;p&gt;To do this, make sure the &lt;strong&gt;Heap snapshot&lt;/strong&gt; option is selected and click &lt;strong&gt;Take snapshot&lt;/strong&gt; at the bottom.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now, in the webpage, run the user scenario that creates the memory leak.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Back in the tool, record another heap snapshot by clicking the &lt;strong&gt;Record heap snapshot&lt;/strong&gt; button in the top left corner.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;With the new snapshot displayed, click the drop-down (which is currently set to &lt;strong&gt;Summary&lt;/strong&gt;) and change its value to &lt;strong&gt;Comparison&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Verify that the second drop-down, to the right, has the first snapshot selected. If you record more snapshots, make sure you&#39;re comparing to the right baseline.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-memory-leaks-1.png&quot; alt=&quot;Microsoft Edge, with a demo webpage, and DevTools on the side with the Memory tool showing 2 snapshots have been recorded&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In this comparison view, sort by different columns to see how memory changed during the user scenario.&lt;/p&gt;
&lt;p&gt;Sort by the &lt;strong&gt;Size Delta&lt;/strong&gt; column to see how much memory each object type has increased (or decreased) since the baseline snapshot. You can also sort by &lt;strong&gt;New&lt;/strong&gt; and &lt;strong&gt;Deleted&lt;/strong&gt; to see which objects have been created or deleted since the baseline.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Expand object types and click on individual objects to see more details in the &lt;strong&gt;Retainers&lt;/strong&gt; panel at the bottom. You should be able to find references to your own code where objects were added, eventually leading to finding the root cause of the leak!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-memory-leaks-2.png&quot; alt=&quot;The Memory tool in comparison mode, with one object selected, showing a list of retainers at the bottom, with links to source code&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  
  <entry>
    <title>Add custom headers to the network table</title>
    <link href="https://devtoolstips.org/tips/en/custom-headers-in-network-table/"/>
    <updated>2023-06-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/custom-headers-in-network-table/</id>
    <content type="html">&lt;p&gt;On the web, when a client (a browser) and a server communicate using HTTP, the requests and responses they send to each other contain headers. These headers are key/value pairs that contain metadata about the request and the response. Common examples of headers include the &lt;code&gt;Content-Type&lt;/code&gt; header, which tells the browser what type of content the server is sending back, or the &lt;code&gt;User-Agent&lt;/code&gt; header, which tells the server what browser the client is using.&lt;/p&gt;
&lt;p&gt;It&#39;s also possible to add custom headers to requests and responses. This is often used by proprietary software and for debugging purposes. For example, the IIS web server adds a &lt;code&gt;X-Powered-By&lt;/code&gt; header to responses.&lt;/p&gt;
&lt;p&gt;In Chrome and Edge, you can configure the &lt;strong&gt;Network&lt;/strong&gt; tool to display any custom header you want in the request table directly, alongside the columns that are already displayed:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools and go to the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Right-click on any of the columns in the request table, and then click &lt;strong&gt;Response Headers&lt;/strong&gt; &amp;gt; &lt;strong&gt;Manage Header Columns&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Manage Header Columns&lt;/strong&gt; popup window, click &lt;strong&gt;Add Custom Header&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Type your custom header name and press &lt;kbd&gt;Add&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/custom-headers-in-network-table.png&quot; alt=&quot;Edge DevTools Network tool, showing a list of requests in the table, and the x-powered-by custom header as a column&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find the CSS rule that causes a specific style to apply</title>
    <link href="https://devtoolstips.org/tips/en/find-rule-that-causes-style/"/>
    <updated>2023-06-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-rule-that-causes-style/</id>
    <content type="html">&lt;p&gt;Here is the scenario: you know there&#39;s a specific style that applies to an HTML element in your web page, say some padding, but you can&#39;t seem to find where, in the CSS code, that style is coming from.&lt;/p&gt;
&lt;p&gt;This can easily happen when working on a large codebase where a lot of CSS rules apply to the element you&#39;re looking at.&lt;/p&gt;
&lt;p&gt;One neat way to help with this is to use the &lt;strong&gt;Computed&lt;/strong&gt; panel:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools, and select the element you&#39;re interested in.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Elements&lt;/strong&gt; (or &lt;strong&gt;Inspector&lt;/strong&gt;) tool, open the &lt;strong&gt;Computed&lt;/strong&gt; sidebar panel.&lt;/li&gt;
&lt;li&gt;In the list, search for the CSS property you are interested in, say &lt;code&gt;padding-bottom&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Expand the little arrow next to the property name to see the CSS rule (or rules) that caused this style to be applied.&lt;/li&gt;
&lt;li&gt;Click the first link in the list to jump to the actual location, in your code, where the rule is defined. In Firefox, you will end up in the &lt;strong&gt;Style Editor&lt;/strong&gt; tool, and in Chromium-based browser the link will take you to the &lt;strong&gt;Sources&lt;/strong&gt; tool.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-rule-that-causes-style-1.png&quot; alt=&quot;The Elements tool in Chrome, showing the Computed tab. The expander icon next to the CSS property has been clicked, revealing the stylesheet location where this style comes from&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Quick note: in Chrome, Edge, and Safari only, you can also jump from the &lt;strong&gt;Computed&lt;/strong&gt; panel to the right place in the &lt;strong&gt;Styles&lt;/strong&gt; panel by clicking to the right of the property name:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-rule-that-causes-style-2.png&quot; alt=&quot;The Elements tool in Chrome, showing the Computed tab. The hovered property has an arrow icon next to it that can be clicked to go to the corresponding place in the Styles panel.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Debug your Safari Web Apps on macOS</title>
    <link href="https://devtoolstips.org/tips/en/debug-safari-mac-webapps/"/>
    <updated>2023-06-09T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-safari-mac-webapps/</id>
    <content type="html">&lt;p&gt;Starting with &lt;a href=&quot;https://webkit.org/blog/14205/news-from-wwdc23-webkit-features-in-safari-17-beta/&quot;&gt;Safari 17 (announced at WWDC 2023)&lt;/a&gt; any website you use in Safari can be installed as a Web App on macOS. Once installed, the Web App shows up like any other app on macOS, in all of the same places, like in the Dock. It also has its own standalone window.&lt;/p&gt;
&lt;p&gt;Once installed, you can debug your Web Apps using the Web Inspector in Safari, here is how:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you haven&#39;t done this already, enable the developer features in Safari. This only needs to be done once:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In Safari, go to &lt;strong&gt;Safari&lt;/strong&gt; &amp;gt; &lt;strong&gt;Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Advanced&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Show features for web developers&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open your Web App.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Safari, go to the &lt;strong&gt;Develop&lt;/strong&gt; menu.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the device your Web App is running on. This will be your Mac&#39;s machine name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the submenu, select the Web App you want to debug.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To learn more, see &lt;a href=&quot;https://developer.apple.com/documentation/safari-developer-tools/develop-menu&quot;&gt;Safari&#39;s Develop menu documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-safari-mac-webapps.png&quot; alt=&quot;The Develop menu in the Safari menu bar, showing different devices and debugging targets&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Understand when the Console opens in the main panel and in the drawer</title>
    <link href="https://devtoolstips.org/tips/en/understand-console-tab-drawer/"/>
    <updated>2023-06-06T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/understand-console-tab-drawer/</id>
    <content type="html">&lt;p&gt;Have you noticed how the &lt;strong&gt;Console&lt;/strong&gt; tool is sometimes displayed in a top-level tab (just like all other tools), and sometimes in a split pane at the bottom, below the main tool?&lt;/p&gt;
&lt;p&gt;If you&#39;ve been confused by this in the past, this tip should hopefully help you understand the logic behind it.&lt;/p&gt;
&lt;h2 id=&quot;the-main-panel-vs.-the-drawer&quot; tabindex=&quot;-1&quot;&gt;The main panel vs. the drawer &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/understand-console-tab-drawer/#the-main-panel-vs.-the-drawer&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;All browser DevTools have a main area, let&#39;s call it the main panel, and typically display their tools as tabs in this main panel.&lt;/p&gt;
&lt;p&gt;But they also also have a bottom area called the &lt;strong&gt;drawer&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This area is not always displayed and can be toggled by pressing the &lt;kbd&gt;Escape&lt;/kbd&gt; on your keyboard. If you don&#39;t see the drawer, press &lt;kbd&gt;Escape&lt;/kbd&gt; and it should appear, therefore splitting the DevTools window into 2 parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The main area at the top, that contains all of your tools.&lt;/li&gt;
&lt;li&gt;The drawer area at the bottom, where other tools can be used too.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here is what DevTools looks like, when the drawer isn&#39;t displayed:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/understand-console-tab-drawer-1.png&quot; alt=&quot;DevTools, with just one tool displayed, the Elements tool&quot; /&gt;&lt;/p&gt;
&lt;p&gt;After pressing &lt;kbd&gt;Escape&lt;/kbd&gt;, here is what DevTools looks like, with the drawer at the bottom:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/understand-console-tab-drawer-2.png&quot; alt=&quot;DevTools, with one tool displayed at the top, the Elements tool, and the drawer at the bottom, showing the Console&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;what&#39;s-in-the-drawer%3F&quot; tabindex=&quot;-1&quot;&gt;What&#39;s in the drawer? &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/understand-console-tab-drawer/#what&#39;s-in-the-drawer%3F&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Firefox, the drawer only contains the &lt;strong&gt;Console&lt;/strong&gt; tool. So, whenever you feel the need to see your logs, or execute a bit of JavaScript code while working with another tool, just press &lt;kbd&gt;Escape&lt;/kbd&gt;.&lt;/p&gt;
&lt;p&gt;In Chrome or Edge, the drawer has its own tabbar, just like the main panel, which can contain the &lt;strong&gt;Console&lt;/strong&gt;, but can also be used to open other tools too.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/understand-console-tab-drawer-3.png&quot; alt=&quot;The tabbar in the drawer, containing multiple tools to choose from&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;what-if-you-open-the-console-in-the-main-panel%3F&quot; tabindex=&quot;-1&quot;&gt;What if you open the Console in the main panel? &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/understand-console-tab-drawer/#what-if-you-open-the-console-in-the-main-panel%3F&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This is where things may be confusing: what if you open the drawer to display the &lt;strong&gt;Console&lt;/strong&gt; and then you also open the &lt;strong&gt;Console&lt;/strong&gt; in the main panel?&lt;/p&gt;
&lt;p&gt;When you do this, the drawer hides itself automatically. This happens because there is only one instance of the &lt;strong&gt;Console&lt;/strong&gt; tool in DevTools. Whether it&#39;s displayed in the main panel or in the drawer makes no difference, it&#39;s the same tool that&#39;s used.&lt;/p&gt;
&lt;p&gt;So, remember, if you select the &lt;strong&gt;Console&lt;/strong&gt; in the main panel when it&#39;s already displayed in the drawer, the drawer hides away, only to return once you switch over to a different tool.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/understand-console-tab-drawer-4.gif&quot; alt=&quot;DevTools with the Console in the drawer, hiding and appearing again when the user selects the Console in the main panel and then goes back to the Elements tool&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Know which of the font in a font-family was actually used</title>
    <link href="https://devtoolstips.org/tips/en/see-which-font-was-used-in-font-family/"/>
    <updated>2023-06-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/see-which-font-was-used-in-font-family/</id>
    <content type="html">&lt;p&gt;The CSS &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/font-family&quot;&gt;&lt;code&gt;font-family&lt;/code&gt;&lt;/a&gt; property let&#39;s you define a comma-separated list of fonts that the browser engine should choose from (in priority order) to render text. For example, with &lt;code&gt;font-family: &amp;quot;Gill Sans&amp;quot;, sans-serif;&lt;/code&gt; the browser will first try to use the &lt;code&gt;Gill Sans&lt;/code&gt; font, and if it&#39;s not available on the current device, it will fall back to whatever is the default &lt;code&gt;sans-serif&lt;/code&gt; font on this device.&lt;/p&gt;
&lt;p&gt;As a web developer, it&#39;s often useful to know which font was actually used in a long list of fallback fonts.&lt;/p&gt;
&lt;p&gt;On Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools, and open the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Select the element you want to inspect.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Rules&lt;/strong&gt; sidebar, find the &lt;code&gt;font-family&lt;/code&gt; property that applies to this element.&lt;/li&gt;
&lt;li&gt;Check which font name in the property value is underlined. This is the font the browser selected.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-which-font-was-used-in-font-family.png&quot; alt=&quot;Firefox, DevTools is opened on the side, showing the Inspector tool and the Rules sidebar tab. The font-family property shows a long list of fonts, with one of them being underlined&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Important note&lt;/strong&gt;: this is different from knowing which font was used to actually render text. To make this clearer, there are two levels to keep in mind:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The CSS defined font in the &lt;code&gt;font-family&lt;/code&gt; property, which is the font(s) that you, the web author, want to use. This may contain actual font names or generic font names such as &lt;code&gt;serif&lt;/code&gt; or &lt;code&gt;system-ui&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The actual font face the browser used to render some text. This is the font file that the browser finally chose to render the text. This font file contains the actual glyphs displayed on the rendered web page.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The defined and rendered fonts may be different for a number of reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The defined font is not available on the system.&lt;/li&gt;
&lt;li&gt;The defined font is available, but doesn&#39;t contain all the glyphs required to render the text. In this case, the browser will fall back to another font that contains the missing glyphs.&lt;/li&gt;
&lt;li&gt;The defined font is a generic font name, such as &lt;code&gt;serif&lt;/code&gt; or &lt;code&gt;system-ui&lt;/code&gt;, which the browser will map to a specific font on the system.&lt;/li&gt;
&lt;li&gt;The defined font is something like &lt;code&gt;Arial&lt;/code&gt;, and is available, but the text contains both normal, bold, and italic text, in which case the browser may use different font files to render the different styles.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want to know which final font was used to &lt;strong&gt;render&lt;/strong&gt; a piece of text, see: &lt;a href=&quot;https://devtoolstips.org/tips/en/see-which-font-was-used-in-font-family/list-used-fonts.md&quot;&gt;List the fonts used on a page, or an element&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find all elements with a specific style</title>
    <link href="https://devtoolstips.org/tips/en/find-all-elements-with-style/"/>
    <updated>2023-05-31T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-all-elements-with-style/</id>
    <content type="html">&lt;p&gt;Let&#39;s say you want to list all of the elements on a page that are absolutely positioned. Or maybe you want to find all of the elements that use CSS grid. How would you do that?&lt;/p&gt;
&lt;p&gt;One way is to run a few lines of JavaScript code in the &lt;strong&gt;Console&lt;/strong&gt; tool to iterate over all of the elements and check their computed styles. Here&#39;s how:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy the below code snippet and paste it in the &lt;strong&gt;Console&lt;/strong&gt;. Change the &lt;code&gt;whatToFind&lt;/code&gt; object to match your needs.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; whatToFind &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  property&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;position&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  values&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;absolute&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; walker &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createTreeWalker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br /&gt;  document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  NodeFilter&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;SHOW_ELEMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token parameter&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; style &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;getComputedStyle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;el&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;whatToFind&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; whatToFind&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;values&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;style&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; NodeFilter&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;FILTER_ACCEPT&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; NodeFilter&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;FILTER_SKIP&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;walker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;nextNode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;walker&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;currentNode&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Press &lt;kbd&gt;Enter&lt;/kbd&gt; and voila! In the screenshot below, all of the absolutely positioned elements on the page are listed.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-all-elements-with-style.png&quot; alt=&quot;The Firefox DevTools Console tool, with the code shown on the left, and the resulting nodes listed on the right&quot; /&gt;&lt;/p&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;If you wanted to find all of the elements that use CSS grid, you would change the &lt;code&gt;whatToFind&lt;/code&gt; object to this:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; whatToFind &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  property&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;display&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  values&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;grid&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;inline-grid&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To avoid having to copy or type this code every time, you can also use the &lt;strong&gt;Snippet&lt;/strong&gt; tool in Chromium-based browsers as explained in &lt;a href=&quot;https://devtoolstips.org/tips/en/find-all-elements-with-style/use-scripts-as-snippets.md&quot;&gt;Re-use scripts as snippets&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Inspect and debug iframes</title>
    <link href="https://devtoolstips.org/tips/en/inspect-debug-iframes/"/>
    <updated>2023-05-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/inspect-debug-iframes/</id>
    <content type="html">&lt;p&gt;If the page you are working on contains an iframe which you want to inspect and debug, you can actually use DevTools to do so. This can be very useful when working with coding playground sites like &lt;a href=&quot;https://codepen.io/&quot;&gt;CodePen&lt;/a&gt;, &lt;a href=&quot;https://jsfiddle.net/&quot;&gt;JSFiddle&lt;/a&gt;, or &lt;a href=&quot;https://glitch.com/&quot;&gt;Glitch&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;firefox&quot; tabindex=&quot;-1&quot;&gt;Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/inspect-debug-iframes/#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firefox has an iframe selector button in its toolbar that lets you select the iframe you want to inspect. Once selected, the &lt;strong&gt;Inspector&lt;/strong&gt; and &lt;strong&gt;Console&lt;/strong&gt; tools will be scoped to the iframe you selected. This means that you will only see the DOM tree and the console messages for the iframe you selected. This also means that any JavaScript expression you execute in the &lt;strong&gt;Console&lt;/strong&gt; tool will be executed in the context of the iframe.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open Firefox DevTools.&lt;/li&gt;
&lt;li&gt;In the main toolbar, click &lt;strong&gt;Select an iframe as the currently targeted document&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the iframe you want to inspect.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/inspect-debug-iframes-firefox.png&quot; alt=&quot;Firefox, with DevTools opened on the side, showing the iframe selector button in the toolbar&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;chrome%2C-edge%2C-safari&quot; tabindex=&quot;-1&quot;&gt;Chrome, Edge, Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/inspect-debug-iframes/#chrome%2C-edge%2C-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chromium-based browsers and Safari have a &lt;strong&gt;JavaScript context&lt;/strong&gt; selector button located in the &lt;strong&gt;Console&lt;/strong&gt; tool which allows you to select the iframe you want to execute JavaScript expressions in. This button does not change what&#39;s visible in the &lt;strong&gt;Elements&lt;/strong&gt; tool, it only changes the JavaScript context in which the &lt;strong&gt;Console&lt;/strong&gt; tool works.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Console&lt;/strong&gt; toolbar, click &lt;strong&gt;JavaScript context&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the context you want to execute JavaScript expressions in.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/inspect-debug-iframes-chrome.png&quot; alt=&quot;Chrome, with the Console in DevTools, opened on the side, showing the JS context selector button&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Take high-resolution screenshots of web pages</title>
    <link href="https://devtoolstips.org/tips/en/take-high-res-screenshots/"/>
    <updated>2023-05-19T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/take-high-res-screenshots/</id>
    <content type="html">&lt;p&gt;Taking screenshots of all or parts of web pages is super useful (scroll down to the &lt;em&gt;See Also&lt;/em&gt; part at the bottom of this page for more tips on that). But sometimes, the resulting screenshots aren&#39;t high-resolution enough for your needs.&lt;/p&gt;
&lt;p&gt;It turns you can make DevTools take high-resolution screenshots of your web pages too!&lt;/p&gt;
&lt;h2 id=&quot;from-the-console-in-firefox&quot; tabindex=&quot;-1&quot;&gt;From the Console in Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/take-high-res-screenshots/#from-the-console-in-firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firefox has a super handy &lt;code&gt;:screenshot&lt;/code&gt; command you can use in the &lt;strong&gt;Console&lt;/strong&gt; tool to take screenshots. It takes a few options, including &lt;code&gt;--dpr&lt;/code&gt; to specify the device pixel ratio. The default value is &lt;code&gt;1&lt;/code&gt;, but you can set it to &lt;code&gt;2&lt;/code&gt;, &lt;code&gt;3&lt;/code&gt;, or any other number to take screenshots at higher resolutions.&lt;/p&gt;
&lt;p&gt;For example: &lt;code&gt;:screenshot --dpr 3 --fullpage&lt;/code&gt; will take a screenshot of the full page at three times the resolution.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/take-high-res-screenshots-firefox.png&quot; alt=&quot;Firefox, with DevTools opened, and the Console tool visible, showing that :screenshot command&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Find out more about the &lt;code&gt;:screenshot&lt;/code&gt; command and its other options in the &lt;a href=&quot;https://firefox-source-docs.mozilla.org/devtools-user/web_console/helpers/index.html&quot;&gt;Firefox DevTools documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;from-device-mode-in-chromium-based-browsers&quot; tabindex=&quot;-1&quot;&gt;From Device Mode in Chromium-based browsers &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/take-high-res-screenshots/#from-device-mode-in-chromium-based-browsers&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here&#39;s a nice trick to do a similar thing in Chromium-based browsers (Chrome, Edge, Brave, etc.):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools and go to the &lt;strong&gt;Device Mode&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Dimensions&lt;/strong&gt; dropdown menu and select &lt;strong&gt;Responsive&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;More options&lt;/strong&gt; (&lt;code&gt;⋮&lt;/code&gt;) and select &lt;strong&gt;Add device pixel ratio&lt;/strong&gt;. This will add a new DPR dropdown to the device toolbar where you can select the DPR value.&lt;/li&gt;
&lt;li&gt;In the DPR dropdown, select the highest value to take the highest resolution screenshot.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;More options&lt;/strong&gt; (the three dots icon) and then click &lt;strong&gt;Capture full size screenshot&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/take-high-res-screenshots-edge-1.png&quot; alt=&quot;Edge DevTools showing the options menu with the Add device pixel ratio option highlighted&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/take-high-res-screenshots-edge-2.png&quot; alt=&quot;Edge DevTools in Device Emulation mode, showing the DPR option to select the DPR value&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Customize the columns shown in console.table</title>
    <link href="https://devtoolstips.org/tips/en/customize-console-table-columns/"/>
    <updated>2023-05-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/customize-console-table-columns/</id>
    <content type="html">&lt;p&gt;The &lt;a href=&quot;https://devtoolstips.org/tips/en/customize-console-table-columns/console-table-group-assert.md&quot;&gt;&lt;code&gt;console.table&lt;/code&gt;&lt;/a&gt; method is great for displaying tabular data in the console, but what if the objects your&#39;re logging contain a lot of properties, causing a lot of columns to appear in the console?&lt;/p&gt;
&lt;p&gt;For example, let&#39;s log all DOM elements on a page with &lt;code&gt;console.table($$(&amp;quot;*&amp;quot;))&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/customize-console-table-columns.png&quot; alt=&quot;Example of a console.table output in Chrome DevTools showing a lot of columns, making it hard to read each column header&quot; /&gt;&lt;/p&gt;
&lt;p&gt;You can actually customize the columns that are shown in the table by passing an array of strings as a second argument to &lt;code&gt;console.table()&lt;/code&gt;. This array should contain the names of the properties you want to display.&lt;/p&gt;
&lt;p&gt;Let&#39;s log all DOM elements on the page as before, but this time, let&#39;s pass an array containing just the few properties we want to display for each element: &lt;code&gt;console.table($$(&amp;quot;*&amp;quot;), [&amp;quot;tagName&amp;quot;, &amp;quot;id&amp;quot;, &amp;quot;className&amp;quot;]);&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/customize-console-table-columns-2.png&quot; alt=&quot;Example of a console.table output in Chrome DevTools showing just a few specific columns&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Speed up or slow down a video</title>
    <link href="https://devtoolstips.org/tips/en/change-video-playback-rate/"/>
    <updated>2023-05-05T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/change-video-playback-rate/</id>
    <content type="html">&lt;p&gt;You can speed up or slow down a video on a website by using the &lt;a href=&quot;https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/playbackRate&quot;&gt;&lt;code&gt;playbackRate&lt;/code&gt;&lt;/a&gt; property of the video element.&lt;/p&gt;
&lt;p&gt;This can be very useful for when the website makes it tricky to do this in the UI!&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; element by either right-clicking on it and choosing &lt;strong&gt;Inspect Element&lt;/strong&gt; or by using the &lt;strong&gt;Elements&lt;/strong&gt; or &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;$0.playbackRate = 2&lt;/code&gt; and press &lt;strong&gt;Enter&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This number you choose is the multiplier for the playback speed. So &lt;code&gt;2&lt;/code&gt; will make the video play twice as fast, &lt;code&gt;0.5&lt;/code&gt; will make it play at half the speed, etc.&lt;/p&gt;
&lt;p&gt;Thank you &lt;a href=&quot;https://twitter.com/umaar/status/1654079892240171010&quot;&gt;Umar Hansa&lt;/a&gt; for this tip!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/change-video-playback-rate.png&quot; alt=&quot;Screenshot of the Console tool showing the playbackRate property&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Debug your print CSS styles by simulating print media</title>
    <link href="https://devtoolstips.org/tips/en/debug-print-css-styles/"/>
    <updated>2023-05-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-print-css-styles/</id>
    <content type="html">&lt;p&gt;If you work on a webpage that&#39;s supposed to be printed, you probably want to test your print CSS styles. You can use your browser&#39;s print preview of course, but what if you need to debug the CSS?&lt;/p&gt;
&lt;p&gt;DevTools has a way to simulate the print media right in the browser tab where DevTools is opened. This way you don&#39;t need to open the browser&#39;s print preview (or worse, actually print the webpage on a sheet of paper). You can stay in the same tab, and use the same DevTools to debug your print-specific styles!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;In the toolbar of the &lt;strong&gt;Rules&lt;/strong&gt; sidebar tab, use the &lt;strong&gt;Toggle print media simulation for the page&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-print-css-styles-firefox.png&quot; alt=&quot;Firefox, with DevTools open, showing the Inspector tool, with the print media button&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Edge or Chrome:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Rendering&lt;/strong&gt; tool (you can access it easily by using the &lt;a href=&quot;https://devtoolstips.org/tips/en/debug-print-css-styles/execute-commands.md&quot;&gt;&lt;strong&gt;Command menu&lt;/strong&gt;&lt;/a&gt; and typing &amp;quot;Rendering&amp;quot;).&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;Emulate CSS media type&lt;/strong&gt; drop-down.&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;Print&lt;/strong&gt; option.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-print-css-styles-chrome.png&quot; alt=&quot;Chrome, with DevTools open, showing the Rendering tool in the drawer, with the media emulation drop-down showing the Print option&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Emulation options&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Toggle &lt;strong&gt;Media type&lt;/strong&gt; to &amp;quot;print&amp;quot;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;Tip: open two panes side-by-side and set one to print media to compare the print and screen versions of your page.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-print-css-styles-polypane.png&quot; alt=&quot;Polypane with the Emulation options open, showing the media type option set to &amp;quot;print&amp;quot;&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Safari:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Elements&lt;/strong&gt; panel, click the printer icon in the toolbar at the top to force the page to use the print media styles.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-print-styles-safari.png&quot; alt=&quot;Safari showing print media styles for CSS Tricks with the printer icon highlighted to toggle the option&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Measure arbitrary distances in the page</title>
    <link href="https://devtoolstips.org/tips/en/measure-distances/"/>
    <updated>2023-04-05T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/measure-distances/</id>
    <content type="html">&lt;p&gt;Do you need to find out the dimensions of any element or area in the page? Or perhaps the distance between two things?&lt;/p&gt;
&lt;p&gt;If you do, Firefox DevTools may be the right tool for the job.&lt;/p&gt;
&lt;p&gt;First, enable the tool, &lt;strong&gt;you only need to do this once&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Settings&lt;/strong&gt; panel by pressing &lt;kbd&gt;F1&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;Measure a portion of the page&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The ruler icon now appears in the DevTools toolbar.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Whenever you need to measure something in the page:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click the ruler icon in the toolbar.&lt;/li&gt;
&lt;li&gt;Click and drag in the page to start measuring an arbitrary area.&lt;/li&gt;
&lt;li&gt;You can also resize the measured area by dragging the handles after releasing the mouse button.&lt;/li&gt;
&lt;li&gt;To measure something else, just start click and dragging somewhere else.&lt;/li&gt;
&lt;li&gt;Click the ruler icon in the toolbar again to stop the tool.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/measure-distances.png&quot; alt=&quot;Firefox with DevTools docked on the side. The measure tool icon is in the DevTools toolbar and has been clicked. An arbitrary area has been defined on the page and its dimensions are displayed in a tooltip&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Replay a XHR request</title>
    <link href="https://devtoolstips.org/tips/en/replay-xhr/"/>
    <updated>2023-03-28T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/replay-xhr/</id>
    <content type="html">&lt;p&gt;When you&#39;re debugging an XHR request to a backend service that doesn&#39;t respond with the right things it can be useful to send the request over and over again. Reloading the entire page to do so is tedious.&lt;/p&gt;
&lt;p&gt;In Chrome or Edge DevTools, you can simply replay the same XHR request:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Find the XHR request in the list that you want to resend. Note that this only works with XHR requests, and not Fetch requests.&lt;/li&gt;
&lt;li&gt;Right-click the request and click &lt;strong&gt;Replay XHR&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: you can also edit the request before resending it! To learn more, see &lt;a href=&quot;https://devtoolstips.org/tips/en/replay-xhr/edit-and-resend-network-requests.md&quot;&gt;Edit and resend faulty network requests to debug them&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/replay-xhr.png&quot; alt=&quot;Chrome&#39;s Network tool, with the Replay XHR contextual menu item&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find broken links</title>
    <link href="https://devtoolstips.org/tips/en/find-broken-links/"/>
    <updated>2023-03-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-broken-links/</id>
    <content type="html">&lt;p&gt;&lt;em&gt;The link to X on page Y doesn&#39;t work&lt;/em&gt; is probably a bug report you&#39;ve received at some point. But how do you find these broken links before someone else does?&lt;/p&gt;
&lt;p&gt;In Polypane, the &lt;strong&gt;Outline Panel&lt;/strong&gt; will show you all the links on the page, and check if they return a 200 status code, or if they return an error code (like 404, or 500).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-broken-links-polypane.png&quot; alt=&quot;Polypane, with the outline panel open. Two of the links show a 404 error code&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Along with broken URLs, Polypane also finds unfinished/placeholder URLs like &lt;code&gt;mailto:&lt;/code&gt; and &lt;code&gt;https://&lt;/code&gt; without anything else after that text.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>List the fonts used on a page, or an element</title>
    <link href="https://devtoolstips.org/tips/en/list-used-fonts/"/>
    <updated>2023-03-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/list-used-fonts/</id>
    <content type="html">&lt;p&gt;&lt;em&gt;&amp;quot;What font is that?&amp;quot;&lt;/em&gt; or &lt;em&gt;&amp;quot;Why is this font used?&amp;quot;&lt;/em&gt; are probably questions you&#39;ve asked yourself while working on a website design.&lt;/p&gt;
&lt;p&gt;However, it&#39;s not always easy to know which fonts are actually used on a webpage and looking at the CSS the page uses might not always give you the answer.&lt;/p&gt;
&lt;p&gt;Webpages often define multiple different fonts, for example: &lt;code&gt;font-family: Baskerville, &amp;quot;Baskerville Old Face&amp;quot;, &amp;quot;Hoefler Text&amp;quot;, Garamond, &amp;quot;Times New Roman&amp;quot;, serif;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;When the browser renders a page, if the first font in the list is not available on the device, the browser falls back to the next font. If the next one isn&#39;t available either, it falls back to the next one and so on. Also some fonts are defined with generic names such as &lt;code&gt;serif&lt;/code&gt;, or &lt;code&gt;monospace&lt;/code&gt;, which tells you nothing about which exact font the browser chose to use.&lt;/p&gt;
&lt;p&gt;DevTools can help you determine which fonts are used on a webpage, or on a specific element on a page.&lt;/p&gt;
&lt;h2 id=&quot;in-firefox&quot; tabindex=&quot;-1&quot;&gt;In Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/list-used-fonts/#in-firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firefox has the best tool to inspect fonts. To know which fonts are used on a webpage:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools, and open the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the sidebar, select the &lt;strong&gt;Fonts&lt;/strong&gt; tab.&lt;/p&gt;
&lt;p&gt;The list of fonts used on the page is displayed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can even hover over a font name to see where it&#39;s used on the page.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/list-used-fonts-firefox.png&quot; alt=&quot;Firefox, with DevTools on the side, showing the Fonts panel that contains the list of fonts. One of the fonts is hovered&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To know which fonts are used on a single element:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select the element in the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Fonts&lt;/strong&gt; tab updates and gives the list of fonts used in that single element.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Note that an element may require multiple fonts to render correctly, even if this element only contains a single text node. This can happen when the font used to render the element doesn&#39;t have all the glyphs required to render the text, in which case the browser falls back to another font to render the missing glyphs.&lt;/p&gt;
&lt;h2 id=&quot;in-chrome-or-edge&quot; tabindex=&quot;-1&quot;&gt;In Chrome or Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/list-used-fonts/#in-chrome-or-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Chrome or Edge (or other Chromium-based browsers), you can see which font(s) was/were used to render a given text-containing element:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools and open the &lt;strong&gt;Elements tool&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select an element that has at least one text node. Elements that only contain other elements, and not directly text won&#39;t work.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the sidebar, select the &lt;strong&gt;Computed&lt;/strong&gt; tab, and scroll down the very bottom of the panel.&lt;/p&gt;
&lt;p&gt;The list of fonts that were used to render the text in the element appears.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/list-used-fonts-chrome.png&quot; alt=&quot;Chrome, with Devtools on the side, showing the Computed panel that contains the list of fonts&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-polypane&quot; tabindex=&quot;-1&quot;&gt;In Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/list-used-fonts/#in-polypane&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Polypane, you can see which font was used to render a given text-containing element:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Hold &lt;kbd&gt;Alt&lt;/kbd&gt;/&lt;kbd&gt;Option&lt;/kbd&gt; and hover over the text you want to find the font for.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The rendered font is shown in the tooltip.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On inspection, the font is also shown in the &lt;strong&gt;Element Overview&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/list-used-fonts-polypane.png&quot; alt=&quot;Polypane, with Devtools on the side, showing the Element Overview panel that contains the list of fonts and a node tooltip.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>See network request paths instead of names in the Network tool</title>
    <link href="https://devtoolstips.org/tips/en/see-request-path-instead-of-name/"/>
    <updated>2023-03-09T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/see-request-path-instead-of-name/</id>
    <content type="html">&lt;p&gt;By default, the &lt;strong&gt;Network&lt;/strong&gt; tool displays the name of each requested resource. For example, if a webpage requests an image from &lt;code&gt;https://mysite.com/assets/img/image.png&lt;/code&gt; then the tool only displays &lt;code&gt;image.png&lt;/code&gt; by default instead of the full file path.&lt;/p&gt;
&lt;h2 id=&quot;chrome-and-edge&quot; tabindex=&quot;-1&quot;&gt;Chrome and Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-request-path-instead-of-name/#chrome-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Chrome and Edge DevTools, you can see the full path instead, which can be useful to more easily identify resources in the request list:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Network&lt;/strong&gt; tool, right-click one of the table headers.&lt;/li&gt;
&lt;li&gt;In the list of columns, select &lt;strong&gt;Path&lt;/strong&gt;, and deselect &lt;strong&gt;Name&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-request-path-instead-of-name.png&quot; alt=&quot;The Network tool in Edge, showing the contextual menu that&#39;s used to customize the network list columns&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;firefox&quot; tabindex=&quot;-1&quot;&gt;Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-request-path-instead-of-name/#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firefox doesn&#39;t have a &lt;strong&gt;Path&lt;/strong&gt; option, but you can display URLs instead:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Network&lt;/strong&gt; tool, right-click one of the table headers.&lt;/li&gt;
&lt;li&gt;In the list of columns, select &lt;strong&gt;URL&lt;/strong&gt;, and deselect &lt;strong&gt;File&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thank you &lt;a href=&quot;https://twitter.com/ryanstaniforth/&quot;&gt;Ryan Staniforth&lt;/a&gt; for &lt;a href=&quot;https://twitter.com/ryanstaniforth/status/1633620774744469506&quot;&gt;sharing this tip on Twitter&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Display the current framerate of your webpage</title>
    <link href="https://devtoolstips.org/tips/en/display-current-framerate/"/>
    <updated>2023-03-03T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/display-current-framerate/</id>
    <content type="html">&lt;p&gt;For a super smooth user experience on your website or app, it&#39;s better if the browser manages to render your page at a high framerate. Ideally, this rate should be 60 frames per second (FPS). This gives the browser 16ms to paint each frame. When the webpage doesn&#39;t do anything and the user is just reading the content, that&#39;s not hard to achieve. But if you have complicated JavaScript running and updating the page, then the browser has to squeeze a lot more work in these 16 ms frames.&lt;/p&gt;
&lt;p&gt;A lower than 60 FPS framerate may lead to a degraded user experience where animations and page updates are noticeably janky and interactions feel slow. When debugging low framerate performance issues, it may help to display the current framerate on the screen.&lt;/p&gt;
&lt;p&gt;In Chromium-based browsers, such as Edge or Chrome, it is possible to display an FPS meter on the screen:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;a href=&quot;https://devtoolstips.org/tips/en/display-current-framerate/execute-commands.md&quot;&gt;Command Menu&lt;/a&gt;: type &lt;kbd&gt;Ctrl+Shift+P&lt;/kbd&gt; (or &lt;kbd&gt;cmd+Shift+P&lt;/kbd&gt; on mac).&lt;/li&gt;
&lt;li&gt;Type &lt;strong&gt;FPS&lt;/strong&gt; to display the &lt;strong&gt;Show Frames Per Seconds (FPS) Meter&lt;/strong&gt; command.&lt;/li&gt;
&lt;li&gt;Press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The FPS meter appears in the upper left corner of the webpage, and displays the live framerate as you use the page. Use the Command Menu again to hide the FPS meter.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/display-current-framerate.png&quot; alt=&quot;Chrome, with the FPS meter in the webpage, and DevTools opened to the side, showing the FPS command in the Command Menu&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Detect unused CSS and JavaScript code</title>
    <link href="https://devtoolstips.org/tips/en/detect-unused-code/"/>
    <updated>2023-03-03T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/detect-unused-code/</id>
    <content type="html">&lt;p&gt;To make sure your webpage loads and appears fast for your users, load only the CSS and JS code that your page requires to appear correctly. If some of your CSS or JS code is only needed later, when the user starts interacting with the webpage, then consider deferring this code until it&#39;s really needed.&lt;/p&gt;
&lt;h2 id=&quot;in-chromium-based-browsers&quot; tabindex=&quot;-1&quot;&gt;In Chromium-based browsers &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/detect-unused-code/#in-chromium-based-browsers&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chrome and Edge have a useful &lt;strong&gt;Coverage&lt;/strong&gt; tool that can help identify which parts of code are unused. To detect unused code on page load:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Coverage&lt;/strong&gt; tool by using the &lt;a href=&quot;https://devtoolstips.org/tips/en/detect-unused-code/execute-commands.md&quot;&gt;Command Menu&lt;/a&gt;: type &lt;kbd&gt;Ctrl+Shift+P&lt;/kbd&gt; (or &lt;kbd&gt;cmd+Shift+P&lt;/kbd&gt; on mac), then type &lt;strong&gt;Coverage&lt;/strong&gt; and press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Coverage&lt;/strong&gt;, click the &lt;strong&gt;Start instrumenting coverage and refresh the page&lt;/strong&gt; button (i.e., the refresh button).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Wait for the webpage to reload and for the coverage report to appear.&lt;/p&gt;
&lt;p&gt;The report shows a list of CSS and JS files with a percentage of unused bytes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click on any of the files to open it in the &lt;strong&gt;Sources&lt;/strong&gt; tool.&lt;/p&gt;
&lt;p&gt;The file appears in the tool, and the line number gutter on the left indicates which lines were used, in blue, and which were unused, in red.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can now decide whether some parts of your code can be loaded later, when needed only.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/detect-unused-code.png&quot; alt=&quot;Edge DevTools, with the Coverage tool in the drawer, showing a list of files, and the Sources tool in the main panel, showing one of the files with red and blue bars in the gutter, which indicates which lines are unused vs. used&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-safari&quot; tabindex=&quot;-1&quot;&gt;In Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/detect-unused-code/#in-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Safari, you can detect unused JS code, with the following steps,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Sources&lt;/strong&gt; panel, open the JS file from the left sidebar.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click the coverage icon &lt;code&gt;C&lt;/code&gt; in the toolbar (top-right) to start detecting unexecuted code.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refresh the page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Lines of code that are not executed on page load are greyed out. Executed lines are displayed as normal.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/detect-unused-code-safari.png&quot; alt=&quot;Safari Web Inspector with Sources panel open, showing unexecuted code in a light gray color for a JS file&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Throttle your CPU</title>
    <link href="https://devtoolstips.org/tips/en/throttle-cpu/"/>
    <updated>2023-03-01T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/throttle-cpu/</id>
    <content type="html">&lt;p&gt;Your development machine is very likely much more powerful than the devices your users have (which are probably low-end mobile devices).&lt;/p&gt;
&lt;p&gt;Before you ship your new app or site, thinking that it will run as smoothly as it does on your computer, test it on other devices. Build empathy for your users and what they have to go through while using your app or site.&lt;/p&gt;
&lt;p&gt;The best way to do this is to test on the real devices your users actually have! A proxy to this is to simulate a slower CPU from DevTools.&lt;/p&gt;
&lt;p&gt;To throttle your CPU in Chrome or Edge DevTools:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In DevTools, open the &lt;strong&gt;Performance&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Capture settings&lt;/strong&gt;. It&#39;s the gear icon in the top right corner of the &lt;strong&gt;Performance&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Using the &lt;strong&gt;CPU&lt;/strong&gt; dropdown, simulate a 4x or 6x slowdown.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Even though the setting is in the &lt;strong&gt;Performance&lt;/strong&gt; tool, you don&#39;t need to record a performance trace for the slowdown to take effect. As soon as a slowdown value is set, it takes effect immediately.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/throttle-cpu.png&quot; alt=&quot;The Performance tool in Chrome showing the CPU throttling drop-down.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>See the size of the transferred data for images, scripts, or other resources</title>
    <link href="https://devtoolstips.org/tips/en/get-size-of-resource-types/"/>
    <updated>2023-02-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/get-size-of-resource-types/</id>
    <content type="html">&lt;p&gt;To know how much data your website transfers between the server and the client to display images, or scripts, or anything else:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refresh the page to make sure the list of requests appears in the tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Filter the list of requests to only what you&#39;re interested in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For example, to see only images, click the &lt;strong&gt;Img&lt;/strong&gt; tag in the toolbar (or &lt;strong&gt;Images&lt;/strong&gt; in Firefox).&lt;/li&gt;
&lt;li&gt;Or, to see only JPEG image files, enter &lt;code&gt;.jpg&lt;/code&gt; in the &lt;strong&gt;Filter&lt;/strong&gt; text box (to learn more about filtering, see &lt;a href=&quot;https://devtoolstips.org/tips/en/get-size-of-resource-types/filter-network-requests.md&quot;&gt;Filter requests in the Network panel by status code, mime type and more&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;To see only JavaSript files, click the &lt;strong&gt;JS&lt;/strong&gt; tag in the toolbar.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Look at the transferred size in the status bar at the bottom of the &lt;strong&gt;Network&lt;/strong&gt; tool. The first number is the amount of data transferred for the filtered resources displayed in the tool.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the screenshot below, the &lt;strong&gt;CSS&lt;/strong&gt; and &lt;strong&gt;JS&lt;/strong&gt; tags have been checked in the toolbar, filtering the list of resources down to just stylesheets and JavaScript files, and the status bar shows that these resources amount to 73.8kB total.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/get-size-of-resource-types.png&quot; alt=&quot;The Network tool in Chrome, with the transferred size highlighted&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>View console logs from non-Safari browsers on an iPhone</title>
    <link href="https://devtoolstips.org/tips/en/view-logs-for-other-browsers-on-ios/"/>
    <updated>2023-02-07T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/view-logs-for-other-browsers-on-ios/</id>
    <content type="html">&lt;p&gt;Using the &lt;code&gt;about:inspect&lt;/code&gt; special page you can see your website&#39;s logs in Chrome or Edge running on iPhone!&lt;/p&gt;
&lt;p&gt;This is important because debugging a webpage that&#39;s running in Safari on an iPhone isn&#39;t hard, but debugging the same webpage when it&#39;s running in Chrome or Edge on an iPhone is impossible, and sometimes there are pages that may work in Safari, but not in Chrome or Edge.&lt;/p&gt;
&lt;p&gt;The former requires connecting your iPhone to a Mac via USB, enabling the WebInspector tools on the Mac, and connecting from Safari desktop to Safari mobile (learn more at &lt;a href=&quot;https://webkit.org/web-inspector/enabling-web-inspector/&quot;&gt;Enabling Web Inspector&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The latter, however, is not possible. Even if Chrome and Edge use the webkit webview on iPhone, Apple just doesn&#39;t let you connect to these webviews from your Mac. Because the webview-version of webkit is subtly different from the version of webkit that powers Safari, it&#39;s possible for your webpage to work in Safari but not in Chrome or Edge, even on the same iPhone.&lt;/p&gt;
&lt;p&gt;Thankfully, here is a way to at least see your console logs from these browsers, which is better than nothing:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In Chrome or Edge on iPhone, open a new tab and go to &lt;code&gt;about:inspect&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Start Logging&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Keep this tab open and open a new one.&lt;/li&gt;
&lt;li&gt;In the new tab, go to the site that you need to test and run the user scenario that will trigger a the console logs you need to see.&lt;/li&gt;
&lt;li&gt;Return to the previous tab. Your logs are now displayed on the &lt;code&gt;about:inspect&lt;/code&gt; page.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/view-logs-for-other-browsers-on-ios.png&quot; alt=&quot;Edge on iOS, showing the about:inspect page, filled with logs&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Disable abusive debugger statements that prevent inspecting websites</title>
    <link href="https://devtoolstips.org/tips/en/disable-abusive-debugger-statement/"/>
    <updated>2023-02-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/disable-abusive-debugger-statement/</id>
    <content type="html">&lt;p&gt;Some websites make it impossible to use DevTools by adding &lt;code&gt;debugger&lt;/code&gt; statements in their code.&lt;/p&gt;
&lt;p&gt;The statements don&#39;t do anything for normal users, but as soon as DevTools is opened, the JavaScript execution pauses, and this makes it impossible to debug or inspect the site as normal.&lt;/p&gt;
&lt;p&gt;To disable the abusive &lt;code&gt;debugger&lt;/code&gt; statement:&lt;/p&gt;
&lt;h2 id=&quot;in-firefox%2C-chrome%2C-and-edge&quot; tabindex=&quot;-1&quot;&gt;In Firefox, Chrome, and Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/disable-abusive-debugger-statement/#in-firefox%2C-chrome%2C-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Sources&lt;/strong&gt; tool (or &lt;strong&gt;Debugger&lt;/strong&gt; tool in Firefox).&lt;/li&gt;
&lt;li&gt;Right-click the line number gutter, right next to the &lt;code&gt;debugger&lt;/code&gt; statement.&lt;/li&gt;
&lt;li&gt;Either click &lt;strong&gt;Never pause here&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Or create a new &lt;strong&gt;Conditional breakpoint&lt;/strong&gt;, and enter &lt;code&gt;false&lt;/code&gt; as the condition for this breakpoint.&lt;/li&gt;
&lt;li&gt;Refresh the page.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, everytime this line of code is executed, the nasty &lt;code&gt;debugger&lt;/code&gt; statement will be ignored and the page will run normally!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/disable-abusive-debugger-statement.gif&quot; alt=&quot;The Sources tool in Firefox, showing how to add a conditional breakpoint.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Thank you &lt;a href=&quot;https://twitter.com/quicksave2k/status/1610250172210073607&quot;&gt;François for the tweet&lt;/a&gt; and &lt;a href=&quot;https://github.com/captainbrosset/devtools-tips/issues/66&quot;&gt;Pankaj Parashar for the tip about using the &lt;strong&gt;Never pause here&lt;/strong&gt; option&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;in-safari&quot; tabindex=&quot;-1&quot;&gt;In Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/disable-abusive-debugger-statement/#in-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Sources&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;At the top left of the tool, in the list of breakpoints, click the arrow next to &lt;strong&gt;Debugger Statements&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Any further &lt;code&gt;debugger&lt;/code&gt; statement will be ignored.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Emulate color schemes</title>
    <link href="https://devtoolstips.org/tips/en/emulate-color-schemes/"/>
    <updated>2023-01-13T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/emulate-color-schemes/</id>
    <content type="html">&lt;p&gt;In CSS, you can use the &lt;code&gt;prefers-color-scheme&lt;/code&gt; media feature (&lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/@media/prefers-color-scheme&quot;&gt;docs&lt;/a&gt;) to detect if the user prefers using a light or a dark theme in their operating system. This is useful to style your website in a way that better blends with the rest of the operating system and respects the user&#39;s preference.&lt;/p&gt;
&lt;p&gt;However, it can be a pain to test since you have to go in the operating system&#39;s settings and change the theme there. This can be slow and you might not actually want to change your entire theme just to test a website.&lt;/p&gt;
&lt;p&gt;DevTools to the rescue! With DevTools, you can emulate a different color scheme just for the inspected page. All browsers support it, but it&#39;s slightly different in each one of them.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Inspector&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;In the toolbar of the &lt;strong&gt;Rules&lt;/strong&gt; sidebar tab, use the light and dark color scheme buttons.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-color-schemes-firefox.png&quot; alt=&quot;Firefox, with DevTools open, showing the Inspector tool, with the color scheme buttons&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Edge or Chrome:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;In the toolbar of the &lt;strong&gt;Styles&lt;/strong&gt; pane, open the &lt;strong&gt;Toggle common rendering emulations&lt;/strong&gt; menu (it looks like a paint brush).&lt;/li&gt;
&lt;li&gt;Choose one of the &lt;code&gt;prefers-color-scheme&lt;/code&gt; options.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-color-schemes-edge.png&quot; alt=&quot;Edge, with DevTools open, showing the Elements tool, with the emulation button and color-scheme dropdown menu&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Safari:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;In the toolbar of the tool, click the emulation button and choose a color scheme.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-color-schemes-safari.png&quot; alt=&quot;Safari, with WebInspector open, showing the Elements tool, with the emulation button and dropdown menu&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Next to the pane you want to change, click the emulation icon in the pane header.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Media&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Choose a scheme in the &lt;strong&gt;prefers-color-scheme&lt;/strong&gt; toggle.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-color-schemes-polypane.png&quot; alt=&quot;Polypane&#39;s emulation pane, with the Media tab, showing the prefers-color-scheme toggle&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Simulate multiple devices that are kept in sync</title>
    <link href="https://devtoolstips.org/tips/en/simulate-multiple-devices/"/>
    <updated>2023-01-06T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/simulate-multiple-devices/</id>
    <content type="html">&lt;p&gt;Instead of &lt;a href=&quot;https://devtoolstips.org/tips/en/simulate-multiple-devices/simulate-devices.md&quot;&gt;simulating devices one by one&lt;/a&gt; and switching between them, Polypane supports testing on multiple simulated devices and viewports at the same time.&lt;/p&gt;
&lt;p&gt;It lets you test different simulated devices, viewports and media query features (like light and dark mode) side-by-side while keeping all your interactions (like clicks, hovers and keyboard input) in sync across all devices. This means anything you do in one device happens in all of them.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-devices-polypane.png&quot; alt=&quot;Polypane showing three different devices side-by-side.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://polypane.app/docs/&quot;&gt;Learn more here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Show web vitals</title>
    <link href="https://devtoolstips.org/tips/en/show-web-vitals/"/>
    <updated>2023-01-06T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/show-web-vitals/</id>
    <content type="html">&lt;p&gt;Web vitals are a set of metrics that help you determine how well-built your page is. You can &lt;a href=&quot;https://web.dev/vitals/&quot;&gt;learn more about them here&lt;/a&gt;. These scores can be obtained with various online checks like &lt;a href=&quot;https://web.dev/measure/&quot;&gt;PageSpeed Insights&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In Polypane you can show the current web vitals score of a page and compare it to global averages (CrUX data), as well as find out which parts of the page contribute to your scores.&lt;/p&gt;
&lt;p&gt;To turn them on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Settings menu&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Toggle &lt;strong&gt;Web Vitals Status&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Each pane now shows a small icon that will change from a circle to a square to a rectangle depending on your web vitals score.&lt;/li&gt;
&lt;li&gt;Hover the icon to show an overview:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/show-web-vitals.png&quot; alt=&quot;The web vitals tooltip in Polypane showing a good CLS, LCP and FCP score and a FID score that needs improvement.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In the overview you will find for each web vital the score for the current page and a bar chart of what percentage of visits were good, needed improvement or were bad. Click the &lt;strong&gt;Eye icon&lt;/strong&gt; in front of a web vital, when available, will show which elements contributed to that score. &lt;a href=&quot;https://polypane.app/docs/web-vitals/&quot;&gt;Learn more here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Manipulate global objects on page load, before other scripts run</title>
    <link href="https://devtoolstips.org/tips/en/manipulate-global-objects-on-page-load/"/>
    <updated>2023-01-06T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/manipulate-global-objects-on-page-load/</id>
    <content type="html">&lt;p&gt;When a page loads, and all of its global objects are ready, but before the JavaScript code of the page actually kicks-in, is a great time to inject debugging code. For example, it might be useful to replace global functions with ones that contain altered code.&lt;/p&gt;
&lt;p&gt;Safari lets you do this by creating an &lt;strong&gt;Inspector Bootstrap Script&lt;/strong&gt;. This script is guaranteed to run after JavaScript global objects have been created, as long as DevTools is opened.&lt;/p&gt;
&lt;p&gt;To create a bootstrap script:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Sources&lt;/strong&gt; tool&lt;/li&gt;
&lt;li&gt;At the bottom of the sidebar, click &lt;strong&gt;Add resource&lt;/strong&gt; (&lt;code&gt;+&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;Inspector Bootstrap Script&lt;/strong&gt; type.&lt;/li&gt;
&lt;li&gt;Write the code you need.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/manipulate-global-objects-on-page-load.png&quot; alt=&quot;The Sources tab in Safari&#39;s WebInspector, showing the Add resource button and the Bootstrap script type&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To learn more, see &lt;a href=&quot;https://webkit.org/web-inspector/inspector-bootstrap-script/&quot;&gt;Inspector Bootstrap Script&lt;/a&gt; on the webkit blog.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Autofill forms for testing</title>
    <link href="https://devtoolstips.org/tips/en/form-testing/"/>
    <updated>2023-01-06T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/form-testing/</id>
    <content type="html">&lt;p&gt;In Polypane you can right-click any form on the page and select &lt;strong&gt;Autofill form&lt;/strong&gt; to add dummy values to all input elements. This prevents you from having to go field-by-field to fill in all required fields while developing or testing forms. It also supports clearing a form at once by selecting &lt;strong&gt;Clear form&lt;/strong&gt; from the same context menu.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/form-testing.gif&quot; alt=&quot;Animation of a form being filled after selecting &amp;quot;autofill&amp;quot; in the context menu, followed by the form being emptied after choosing &amp;quot;Clear form&amp;quot; in the context menu.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://polypane.app/docs/form-autofill/&quot;&gt;Learn more here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Reload a page when there&#39;s changes on disk</title>
    <link href="https://devtoolstips.org/tips/en/reload-page-after-change/"/>
    <updated>2023-01-05T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/reload-page-after-change/</id>
    <content type="html">&lt;p&gt;While working on a page locally and you&#39;re not using a hot reloading dev server, you need to reload the browser yourself to see the change. You need to do this every time you save a file. Wouldn&#39;t it be great if this happened automatically?&lt;/p&gt;
&lt;p&gt;Polypane contains a &lt;strong&gt;Live reload&lt;/strong&gt; panel that lets you target a folder, and any change in that folder will either reload the page, or replace just the CSS or image file that you changed without reloading the rest of the page. This way you wont have to leave your code editor even when working on a plain HTML or CSS file and the browser will keep up to date.&lt;/p&gt;
&lt;p&gt;Open the &lt;strong&gt;Live Reload&lt;/strong&gt; panel:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right-click the &lt;strong&gt;reload&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Live reload&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the configuration screen (see screenshot below) select a directory and click &lt;strong&gt;Start watching&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The reload button will show a lightning bolt when live reloading is active.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/reload-page-after-change.png&quot; alt=&quot;Polypane with the live reload panel and reload context menu visible.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;There are specific options to tweak, like which file system events to listen for, how long to wait before reloading (to account for things like SASS compilation time) and whether to show notifications of which files changed. &lt;a href=&quot;https://polypane.app/docs/live-auto-reloading/&quot;&gt;Learn more here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Test your PWA protocol handlers</title>
    <link href="https://devtoolstips.org/tips/en/test-pwa-protocol-handlers/"/>
    <updated>2023-01-04T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/test-pwa-protocol-handlers/</id>
    <content type="html">&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/docs/Web/Progressive_web_apps&quot;&gt;Progressive Web Apps (PWA)&lt;/a&gt; can register themselves to handle URIs with pre-defined or custom protocols (such as &lt;code&gt;mailto&lt;/code&gt;, &lt;code&gt;geo&lt;/code&gt;, or &lt;code&gt;web+foo&lt;/code&gt;). This is a great capability that makes it possible for installed PWAs to feel more like real apps.&lt;/p&gt;
&lt;p&gt;To learn more about how to register a PWA as a protocol handler, see &lt;a href=&quot;https://learn.microsoft.com/microsoft-edge/progressive-web-apps-chromium/how-to/handle-protocols&quot;&gt;Handle protocols in Progressive Web Apps&lt;/a&gt; or  &lt;a href=&quot;https://developer.chrome.com/articles/url-protocol-handler/&quot;&gt;URL protocol handler registration for PWAs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, testing your protocol handlers can be difficult. Thankfully, DevTools in both Chrome and Edge, provide a nice little tool that makes it all a lot easier.&lt;/p&gt;
&lt;p&gt;To test your handler:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Make sure your PWA is installed first.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open your PWA in a browser tab, and open DevTools.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Application&lt;/strong&gt; tool and then click &lt;strong&gt;Manifest&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Scroll down to the &lt;strong&gt;Protocol Handlers&lt;/strong&gt; section.&lt;/p&gt;
&lt;p&gt;If you see a green checkmark, that means your protocol handlers were detected correctly.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the dropdown to select the protocol you want to test, and the textfield to type the rest of the URI.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Test protocol&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Your installed PWA should now be launched automatically, and you can test your protocol handling code.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/test-pwa-protocol-handlers.png&quot; alt=&quot;Microsoft Edge, with the Application tool opened on the side, showing the Protocol Handlers section.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>See formatted JSON responses</title>
    <link href="https://devtoolstips.org/tips/en/see-json-responses/"/>
    <updated>2023-01-04T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/see-json-responses/</id>
    <content type="html">&lt;p&gt;Edge (starting with 110), Firefox and Polypane all have a very nice &lt;strong&gt;JSON viewer&lt;/strong&gt; tool that makes it easy to view JSON responses from your server directly in the browser window.&lt;/p&gt;
&lt;p&gt;You don&#39;t even need to open DevTools for it to work! Just enter the URL to a JSON response in a browser tab, in Edge, Firefox or Polypane, and instead of getting the raw text back, the JSON will be formatted and highlighted.&lt;/p&gt;
&lt;p&gt;You can try it out with &lt;a href=&quot;https://jsonplaceholder.typicode.com/posts/1/comments&quot;&gt;this sample JSON response&lt;/a&gt;, or &lt;a href=&quot;https://codepo8.github.io/json-dummy-data/&quot;&gt;these JSON test files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-json-responses.png&quot; alt=&quot;The JSON viewer in Microsoft Edge.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Note that in Firefox and Polypane, the JSON viewer has a few more options not yet available in Edge:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Search within the response.&lt;/li&gt;
&lt;li&gt;See the raw text.&lt;/li&gt;
&lt;li&gt;See the headers.&lt;/li&gt;
&lt;li&gt;Save the file locally.&lt;/li&gt;
&lt;li&gt;Expand and collapse specific sections (Polypane only)&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Emulate idle detection states</title>
    <link href="https://devtoolstips.org/tips/en/emulate-idle-detection-states/"/>
    <updated>2023-01-04T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/emulate-idle-detection-states/</id>
    <content type="html">&lt;p&gt;The &lt;a href=&quot;https://developer.mozilla.org/docs/Web/API/Idle_Detection_API&quot;&gt;Idle Detection API&lt;/a&gt; is useful for web developers to detect when the user isn&#39;t interacting with their device. This can be useful for chat applications, for example, to mark the user as away.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: this API is only available on Chrome, Opera, and Samsung Internet.&lt;/p&gt;
&lt;p&gt;The problem is testing the code that uses this API can be tricky, or even impossible. In order for your device to be idle, you need to stop using the mouse and keyboard. But in order to check that the code works correctly, you need to interact with the browser DevTools in some way.&lt;/p&gt;
&lt;p&gt;Thankfully, Chrome has a nice little feature in its DevTools to emulate various idle detection states. Here&#39;s how:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Using the &lt;strong&gt;&lt;a href=&quot;https://devtoolstips.org/tips/en/emulate-idle-detection-states/execute-commands.md&quot;&gt;Command Menu&lt;/a&gt;&lt;/strong&gt;, open the &lt;strong&gt;Sensors&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Scroll down and look for the &lt;strong&gt;Emulate Idle Detector state&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;Choose one of the states to test if your code does what it&#39;s supposed to.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-idle-detection-states.png&quot; alt=&quot;Chrome DevTools&#39; Sensors panel, showing a drop-down list with the different states that can be emulated.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.chrome.com/articles/idle-detection/#devtools-support&quot;&gt;Learn more about the Idle Detection API and the corresponding DevTools support&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Debug unwanted scrollbars</title>
    <link href="https://devtoolstips.org/tips/en/debug-unwanted-scrollbars/"/>
    <updated>2023-01-04T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-unwanted-scrollbars/</id>
    <content type="html">&lt;p&gt;Scrollbars can sometimes appear on a webpage unexpectedly. When this happens, finding which HTML element is the cause of the scrollbars isn&#39;t always straightforward. DevTools provides features that help you debug unwanted scrollbars.&lt;/p&gt;
&lt;h2 id=&quot;firefox&quot; tabindex=&quot;-1&quot;&gt;Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-unwanted-scrollbars/#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the DOM tree in the &lt;strong&gt;Inspector&lt;/strong&gt; tool, &lt;strong&gt;scroll&lt;/strong&gt; badges appear next to elements that have scrollbars.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-unwanted-scrollbars-1.png&quot; alt=&quot;Firefox DevTools, with the Inspector panel showing the Scroll badge on an element.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;scroll&lt;/strong&gt; badges help you identify which elements in the DOM tree are scrolling.&lt;/p&gt;
&lt;p&gt;Click a &lt;strong&gt;scroll&lt;/strong&gt; badge to highlight the descendant elements that are causing the scrolling parent to overflow. The &lt;strong&gt;Inspector&lt;/strong&gt; reveals the overflowing elements:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-unwanted-scrollbars-2.png&quot; alt=&quot;Firefox DevTools, with the Inspector panel showing the Overflow badge on 3 highlighted elements.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Once you know which elements are the root cause of the problem, use the &lt;strong&gt;Rules&lt;/strong&gt; sidebar pane to figure out which CSS properties are causing the overflow.&lt;/p&gt;
&lt;p&gt;To learn more, see &lt;a href=&quot;https://firefox-source-docs.mozilla.org/devtools-user/page_inspector/how_to/debug_scrollable_overflow/index.html&quot;&gt;Debug scrollable overflow&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;chrome%2C-edge%2C-and-safari&quot; tabindex=&quot;-1&quot;&gt;Chrome, Edge, and Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-unwanted-scrollbars/#chrome%2C-edge%2C-and-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Similar to Firefox, in the DOM tree in the &lt;strong&gt;Elements&lt;/strong&gt; tool of Chrome, Edge, or Safari DevTools, &lt;strong&gt;scroll&lt;/strong&gt; badges appear next to elements that have scrollbars. The &lt;strong&gt;scroll&lt;/strong&gt; badges help you identify which elements in the DOM tree are scrolling.&lt;/p&gt;
&lt;h2 id=&quot;polypane&quot; tabindex=&quot;-1&quot;&gt;Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-unwanted-scrollbars/#polypane&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Polypane displays an &lt;strong&gt;Horizontal overflow detected&lt;/strong&gt; icon below pages that have a horizontal scrollbar. The &lt;strong&gt;Horizontal overflow detected&lt;/strong&gt; icon helps you understand why a page has a horizontal scrollbar:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-unwanted-scrollbars-3.png&quot; alt=&quot;Polypane, with an overflow icon below a Pane. The text in the tooltip reads &amp;quot;Horizontal overflow detected!&amp;quot;.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To find the elements that are causing the horizontal overflow in the page, click the icon. Polypane finds the elements and highlights them in red:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-unwanted-scrollbars-4.png&quot; alt=&quot;Polypane showing a page. A single element is highlighted in red and is clearly expanding beyond the edge&amp;quot;.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To fix the overflow problem, inspect the highlighted elements.&lt;/p&gt;
&lt;p&gt;To learn more, see &lt;a href=&quot;https://polypane.app/docs/horizontal-overflow/&quot;&gt;Horizontal overflow detection&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find the most expensive CSS selectors</title>
    <link href="https://devtoolstips.org/tips/en/find-expensive-selectors/"/>
    <updated>2022-12-14T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-expensive-selectors/</id>
    <content type="html">&lt;p&gt;When it comes to improving web rendering performance, we often spend time working on JavaScript code. But CSS has an important role to play too in how fast a web page renders. CSS selectors, in particular, can sometimes be slow for the browser engine to match to the DOM of the page, and this can become a big problem when the web page has a large DOM tree, a lot of CSS rules, and where the DOM changes often.&lt;/p&gt;
&lt;p&gt;Chrome and Edge have a useful feature in the &lt;strong&gt;Performance&lt;/strong&gt; tool to investigate inefficient CSS selectors, called &lt;strong&gt;Selector Stats&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So, before blindly rewriting your CSS selectors by following random guidelines you might have found on the web, measure the performance of slow scenarios on your web page, make sure that CSS is indeed having a negative impact, use &lt;strong&gt;Selector Stats&lt;/strong&gt; to get ideas for what to improve, improve your code, and then measure again.&lt;/p&gt;
&lt;p&gt;To use &lt;strong&gt;Selector Stats&lt;/strong&gt; in Chrome or Edge:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Performance&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Capture settings&lt;/strong&gt; in the tool&#39;s top toolbar, and then select the &lt;strong&gt;Enable CSS selector stats&lt;/strong&gt; checkbox.&lt;/li&gt;
&lt;li&gt;Start a new performance recording, run through your slow scenario, and then stop the recording.&lt;/li&gt;
&lt;li&gt;In the captured profile, identify a long-running &lt;strong&gt;Recalculate Style&lt;/strong&gt; event and select it.&lt;/li&gt;
&lt;li&gt;In the bottom section of the &lt;strong&gt;Performance&lt;/strong&gt; tool, open the &lt;strong&gt;Selector Stats&lt;/strong&gt; tab.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;strong&gt;Selector Stats&lt;/strong&gt; tab displays the list of CSS selectors that the browser engine had to (at least attempt to) match during this &lt;strong&gt;Recalculate Style&lt;/strong&gt; event.&lt;/p&gt;
&lt;p&gt;Sort the table by &lt;strong&gt;Elapsed time&lt;/strong&gt; to find the selectors that took the most time for the engine to match. Make sure to review the &lt;strong&gt;Match Attempts&lt;/strong&gt; and &lt;strong&gt;Match Counts&lt;/strong&gt; columns too. For example, if the browser engine attempted to match, say, 1000 elements, but ended up really matching 0 elements, then this selector is likely too broad and could be optimized. Finally, make sure to review the &lt;strong&gt;% of slow-path non-matches&lt;/strong&gt; column. This column tells you the ratio of elements that ended up not matching the selector, and for which the browser engine had to use a less optimized code path to match.&lt;/p&gt;
&lt;p&gt;To view the &lt;strong&gt;Selector Stats&lt;/strong&gt; for the entire profile instead of just a single &lt;strong&gt;Recalculate Style&lt;/strong&gt; event, deselect any &lt;strong&gt;Recalculate Style&lt;/strong&gt; event that you have selected by clicking in an empty area of the profile.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-expensive-selectors.png&quot; alt=&quot;The Performance tool in Chrome showing a recorded profile with a selected Recalculate Style block, and the Selector Stats table below it.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>List all supported console functions</title>
    <link href="https://devtoolstips.org/tips/en/list-console-functions/"/>
    <updated>2022-11-23T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/list-console-functions/</id>
    <content type="html">&lt;p&gt;You&#39;ve probably already used &lt;code&gt;console.log()&lt;/code&gt; in your code to print debugging values to the &lt;strong&gt;Console&lt;/strong&gt; tool in DevTools. But the &lt;code&gt;console&lt;/code&gt; namespace actually has many other functions too!&lt;/p&gt;
&lt;p&gt;To list them all, open the &lt;strong&gt;Console&lt;/strong&gt; tool and type:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;console&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/list-console-functions.png&quot; alt=&quot;Chrome, with the Console panel opened on the side in DevTools, showing the  command result, which is an object containing a list of functions such as assert, clear, debug.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Related:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://devtoolstips.org/tips/en/list-console-functions/console-table-group-assert.md&quot;&gt;console.log() is great, but do you know console.table()? console.group()? console.assert()?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/docs/Web/API/console&quot;&gt;The console documentation on MDN&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://console.spec.whatwg.org/&quot;&gt;The Console API specification&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Hide or pin the information tooltip while inspecting page elements</title>
    <link href="https://devtoolstips.org/tips/en/hide-or-pin-inspect-info-tooltip/"/>
    <updated>2022-10-27T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/hide-or-pin-inspect-info-tooltip/</id>
    <content type="html">&lt;p&gt;When selecting elements from the page using the &lt;strong&gt;inspect&lt;/strong&gt; tool, the hovered elements get highlighted, and an information tooltip follows your mouse around and gives you information about the hovered element.&lt;/p&gt;
&lt;p&gt;You can hide, or pin this information tooltip in Chrome or Edge.&lt;/p&gt;
&lt;h2 id=&quot;to-hide-the-information-tooltip&quot; tabindex=&quot;-1&quot;&gt;To hide the information tooltip &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/hide-or-pin-inspect-info-tooltip/#to-hide-the-information-tooltip&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Start the &lt;strong&gt;inspect&lt;/strong&gt; tool by clicking &lt;strong&gt;Select an element in the page to inspect it&lt;/strong&gt; (the little cursor icon in the top left corner of DevTools).&lt;/li&gt;
&lt;li&gt;Start hovering over elements in the webpage, elements get highlighted and the information tooltip appears.&lt;/li&gt;
&lt;li&gt;Hold the &lt;kbd&gt;Ctrl&lt;/kbd&gt; key on your keyboard, the information tooltip disappears.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/hide-or-pin-inspect-info-tooltip-1.png&quot; alt=&quot;Chrome, with a webpage and DevTools opened to the side. The inspect mode is on, the mouse is hovering an element in the webpage, which is highlighted, but the information tooltip is not displayed.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;to-pin-the-highlight-and-information-tooltip-on-the-current-element&quot; tabindex=&quot;-1&quot;&gt;To pin the highlight and information tooltip on the current element &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/hide-or-pin-inspect-info-tooltip/#to-pin-the-highlight-and-information-tooltip-on-the-current-element&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Start the &lt;strong&gt;inspect&lt;/strong&gt; tool by clicking &lt;strong&gt;Select an element in the page to inspect it&lt;/strong&gt; (the little cursor icon in the top left corner of DevTools).&lt;/li&gt;
&lt;li&gt;Start hovering over elements in the webpage, elements get highlighted and the information tooltip appears.&lt;/li&gt;
&lt;li&gt;Hold the &lt;kbd&gt;Ctrl&lt;/kbd&gt; and &lt;kbd&gt;Alt&lt;/kbd&gt; keys on your keyboard, the highlight and information tooltip are pinned on the current element, and you can move your mouse around without losing this information.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/hide-or-pin-inspect-info-tooltip-2.png&quot; alt=&quot;Chrome, with a webpage and DevTools opened to the side. The inspect mode is on, the mouse is hovering an element in the webpage, but another one is highlighted and has the info tooltip.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Understand flexbox item sizing</title>
    <link href="https://devtoolstips.org/tips/en/understand-flexbox-item-sizing/"/>
    <updated>2022-10-26T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/understand-flexbox-item-sizing/</id>
    <content type="html">&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox&quot;&gt;Flexbox&lt;/a&gt; is a great way to easily distribute elements and empty space in a row or a column, and create interesting layouts.&lt;/p&gt;
&lt;p&gt;It only takes a couple of CSS properties to create nice layouts that automatically adapt to the available space.&lt;/p&gt;
&lt;p&gt;But, all of this power also means that the complexity that the browser engine deals with is hidden from you, the developer. While this is, in general, fine, it tends to become an issue when your flexbox layout isn&#39;t doing the things you want it to do.&lt;/p&gt;
&lt;p&gt;If you&#39;ve ever used flexbox, there might have been times when you&#39;ve wondered: &lt;em&gt;why is this element this big?&lt;/em&gt;, or &lt;em&gt;why is this element not growing to fill that gap?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Firefox has a wonderful tool that can help with this.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right-click on the flexbox item that you&#39;re interested in and select &lt;strong&gt;Inspect&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;DevTools opens up, and the &lt;strong&gt;Inspector&lt;/strong&gt; tool is displayed, with the corresponding element selected.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Layout&lt;/strong&gt; in the &lt;strong&gt;Inspector&lt;/strong&gt; sidebar.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You now have a diagram that represents the size of the flex item, with some annotations that might be useful for understanding why this particular item has been sized this way.&lt;/p&gt;
&lt;p&gt;Here is the information that might be displayed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Content size&lt;/strong&gt;: the size the flex item needs to display its content.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Base size&lt;/strong&gt;: the size that corresponds to the &lt;code&gt;flex-basis&lt;/code&gt; property (or &lt;code&gt;width&lt;/code&gt; in row direction, or &lt;code&gt;height&lt;/code&gt; in column direction). That&#39;s the base size that you wanted to give to this element, before any shrinking or growing happened as part of the flexbox layout.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Flexibility&lt;/strong&gt;: whether the item grew or shrank and by how much. Note that this can also mean &lt;em&gt;how much the item &lt;strong&gt;wanted&lt;/strong&gt; to grow or shrink&lt;/em&gt;, but it might not correspond to the final size. See below.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Max or min size&lt;/strong&gt;: whether the item has a max or min size defined (e.g. using &lt;code&gt;min-width&lt;/code&gt; or &lt;code&gt;max-width&lt;/code&gt; in row direction). This can &lt;em&gt;clamp&lt;/em&gt; the item, even if it wanted to grow or shrink more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Final size&lt;/strong&gt;: the actual final size of the item.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/understand-flexbox-item-sizing.png&quot; alt=&quot;Firefox, with the DevTools Inspector tool opened, showing the Layout sidebar that contains the flex item diagram.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Customize keyboard shortcuts</title>
    <link href="https://devtoolstips.org/tips/en/customize-keyboard-shortcuts/"/>
    <updated>2022-10-26T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/customize-keyboard-shortcuts/</id>
    <content type="html">&lt;p&gt;DevTools comes with tons of keyboard shortcuts. Some are well known (like &lt;code&gt;F12&lt;/code&gt; to open DevTools), but there are many others which you might not be familiar with, and which could make your life easier.&lt;/p&gt;
&lt;p&gt;Chrome and Edge have a screen where you can not only find all of the keyboard shortcuts, but also &lt;strong&gt;customize&lt;/strong&gt; them. Chrome enabled this screen in version 107, and Edge has had it for a longer while.&lt;/p&gt;
&lt;p&gt;To list the shortcuts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools (&lt;code&gt;F12&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Go to the Settings by pressing &lt;code&gt;F1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Shortcuts&lt;/strong&gt; in the sidebar.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can also find the full list of shortcuts here: &lt;a href=&quot;https://learn.microsoft.com/microsoft-edge/devtools-guide-chromium/shortcuts/&quot;&gt;Edge&lt;/a&gt;, &lt;a href=&quot;https://developer.chrome.com/docs/devtools/shortcuts/&quot;&gt;Chrome&lt;/a&gt;, &lt;a href=&quot;https://firefox-source-docs.mozilla.org/devtools-user/keyboard_shortcuts/index.html&quot;&gt;Firefox&lt;/a&gt;, &lt;a href=&quot;https://webkit.org/web-inspector/keyboard-shortcuts/&quot;&gt;Safari&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To customize the shortcuts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Hover one of the shortcuts and click the edit icon (the icon looks like a pencil).&lt;/li&gt;
&lt;li&gt;Press the new key combination you want for this shortcut.&lt;/li&gt;
&lt;li&gt;You can then save the new shortcut, cancel your change, or revert to the shortcut&#39;s initial value.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/customize-keyboard-shortcuts.png&quot; alt=&quot;The Settings panel in Microsoft Edge, showing the keyboard shortcut customization screen.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Re-use scripts as snippets</title>
    <link href="https://devtoolstips.org/tips/en/use-scripts-as-snippets/"/>
    <updated>2022-10-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/use-scripts-as-snippets/</id>
    <content type="html">&lt;p&gt;The &lt;strong&gt;Console&lt;/strong&gt; is great to write short JavaScript expressions that read from the document or manipulate it. But it&#39;s also a terrible editor.&lt;/p&gt;
&lt;p&gt;You can actually use a full editor in Edge, Chrome, and Safari to write more complex scripts and run them in the context of the current page and even keep them for later re-use.&lt;/p&gt;
&lt;p&gt;Note: if you&#39;re looking for a way to do this in Firefox, there isn&#39;t currently one. However, you can &lt;a href=&quot;https://devtoolstips.org/tips/en/use-scripts-as-snippets/multi-line-console.md&quot;&gt;write code on multiple lines&lt;/a&gt; which helps a lot already, and even search through previous Console expressions by pressing &lt;kbd&gt;F9&lt;/kbd&gt; in the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/p&gt;
&lt;h2 id=&quot;in-edge-%26-chrome&quot; tabindex=&quot;-1&quot;&gt;In Edge &amp;amp; Chrome &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/use-scripts-as-snippets/#in-edge-%26-chrome&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Chromium-based browsers, these are called &lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/javascript/snippets&quot;&gt;&lt;strong&gt;snippets&lt;/strong&gt;&lt;/a&gt; and you can access them in the &lt;strong&gt;Sources&lt;/strong&gt; tool by clicking &lt;strong&gt;Snippets&lt;/strong&gt; in the left hand side toolbar (you may have to use the &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; to reach them).&lt;/p&gt;
&lt;p&gt;You can create as many named snippets as you like and remove ones you don&#39;t need any more.&lt;/p&gt;
&lt;p&gt;Snippets have full access to the window object and you can use any of the console API methods in them too. For example, this script would replace each image in the document with its alternative text:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token function&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;img&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; txt &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;span&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;   txt&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; i&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;alt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;   i&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parentNode&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replaceChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;txt&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;   console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;alt&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can run snippets by pressing &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt; (or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt; on mac) or using the button on the bottom of the editor.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/use-scripts-as-snippets-1.png&quot; alt=&quot;The snippets editor in the Sources tool with a snippet open in the editor.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Even better, you can use the &lt;a href=&quot;https://devtoolstips.org/tips/en/use-scripts-as-snippets/execute-commands.md&quot;&gt;Command menu&lt;/a&gt; to run snippets more easily. Simply press &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; (or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; on mac) and type &lt;code&gt;!&lt;/code&gt; followed by the name of your Snippet.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/use-scripts-as-snippets-2.gif&quot; alt=&quot;Running a snippet from the Command menu.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-safari&quot; tabindex=&quot;-1&quot;&gt;In Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/use-scripts-as-snippets/#in-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Safari, these scripts are called Console Snippets and can also be created from the &lt;strong&gt;Sources&lt;/strong&gt; tool by clicking the &lt;code&gt;+&lt;/code&gt; icon at the bottom of the tool, and choosing &lt;strong&gt;Console Snippet...&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/use-scripts-as-snippets-3.gif&quot; alt=&quot;Creating a snippet in Safari.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Simulate different devices and screen sizes</title>
    <link href="https://devtoolstips.org/tips/en/simulate-devices/"/>
    <updated>2022-10-19T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/simulate-devices/</id>
    <content type="html">&lt;p&gt;All browser DevTools have a built-in mode that you can use to test a webpage under different screen sizes and device capabilities.&lt;/p&gt;
&lt;p&gt;As a web developer, it is very important to realize that your website won&#39;t only be used on one type of device. People browse the web with many different device types, from small phones, to large desktop monitors, and everything in between.&lt;/p&gt;
&lt;p&gt;Not only do the devices people use have different screen sizes, but they can also have different pixel densities, support for touch input, network speeds, and more.&lt;/p&gt;
&lt;p&gt;Browser DevTools make it easy to simulate how a webpage might render under different screen sizes and device capabilities. However, note that &lt;strong&gt;this is only a simulation&lt;/strong&gt;, and you should always test your webpage on the real device too. For example, even if the device mode in Chrome DevTools lets you simulate an iPhone screen, it doesn&#39;t actually render the webpage with the same rendering engine as the iPhone would. So, always test on the real device too.&lt;/p&gt;
&lt;h2 id=&quot;available-features&quot; tabindex=&quot;-1&quot;&gt;Available features &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-devices/#available-features&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This simulation mode comes with the following features (more might be available depending on the browser you&#39;re using):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Resize the simulated viewport size by hand.&lt;/li&gt;
&lt;li&gt;Choose one of the pre-defined devices to simulate.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://devtoolstips.org/tips/en/simulate-devices/add-new-devices.md&quot;&gt;Create your own simulated devices&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://devtoolstips.org/tips/en/simulate-devices/take-in-device-screenshots.md&quot;&gt;Capture screenshots&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://devtoolstips.org/tips/en/simulate-devices/throttle-network-speed.md&quot;&gt;Throttle the network speed to test your website on slower connections&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;start-simulating&quot; tabindex=&quot;-1&quot;&gt;Start simulating &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-devices/#start-simulating&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;in-chrome&quot; tabindex=&quot;-1&quot;&gt;In Chrome &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-devices/#in-chrome&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To enable the device mode in Chrome DevTools, click the &lt;strong&gt;Toggle Device Toolbar&lt;/strong&gt; button or press &lt;kbd&gt;Ctrl+Shift+M&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+Shift+M&lt;/kbd&gt; on macOS).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-devices-chrome.png&quot; alt=&quot;Chrome, with DevTools on the side, and the rendered webpage wrapped in the device simulation mode&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;in-edge&quot; tabindex=&quot;-1&quot;&gt;In Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-devices/#in-edge&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To enable the device mode in Edge DevTools, click the &lt;strong&gt;Toggle device emulation&lt;/strong&gt; button or press &lt;kbd&gt;Ctrl+Shift+M&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+Shift+M&lt;/kbd&gt; on macOS).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-devices-edge.png&quot; alt=&quot;Edge, with DevTools on the side, and the rendered webpage wrapped in the device simulation mode&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;in-firefox&quot; tabindex=&quot;-1&quot;&gt;In Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-devices/#in-firefox&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Firefox, you don&#39;t need DevTools to be opened to simulate devices. Click &lt;strong&gt;Open application menu&lt;/strong&gt; &amp;gt; &lt;strong&gt;More tools&lt;/strong&gt; &amp;gt; &lt;strong&gt;Responsive design mode&lt;/strong&gt;, or press &lt;kbd&gt;Ctrl+Shift+M&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+Shift+M&lt;/kbd&gt; on macOS).&lt;/p&gt;
&lt;p&gt;Or, if you&#39;re in DevTools, click the &lt;strong&gt;Responsive Design Mode&lt;/strong&gt; button, or press &lt;kbd&gt;Ctrl+Shift+M&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+Shift+M&lt;/kbd&gt; on macOS).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-devices-firefox.png&quot; alt=&quot;A rendered webpage in Firefox, wrapped in the responsive design mode&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;in-safari&quot; tabindex=&quot;-1&quot;&gt;In Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-devices/#in-safari&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Safari, you don&#39;t need DevTools to be opened to simulate devices. Click &lt;strong&gt;Develop&lt;/strong&gt; in Safari&#39;s menu bar, and then click &lt;strong&gt;Enter Responsive Design Mode&lt;/strong&gt;, or press &lt;kbd&gt;Ctrl+Command+R&lt;/kbd&gt;.&lt;/p&gt;
&lt;p&gt;If you aren&#39;t seeing the &lt;strong&gt;Develop&lt;/strong&gt; menu item, enable it first (this only needs to be done once):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In Safari, in the menu bar, go to &lt;strong&gt;Safari&lt;/strong&gt; &amp;gt; &lt;strong&gt;Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Advanced&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Show features for web developers&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-devices-safari.png&quot; alt=&quot;A rendered webpage in Safari, wrapped in the responsive design mode&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;in-polypane&quot; tabindex=&quot;-1&quot;&gt;In Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-devices/#in-polypane&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Simulating different screen sizes is Polypane&#39;s default behavior. Polypane is the only browser DevTools that allows you to see multiple screen sizes side by side too. To learn more, see &lt;a href=&quot;https://devtoolstips.org/tips/en/simulate-devices/simulate-multiple-devices.md&quot;&gt;Simulate multiple devices that are kept in sync&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-devices-polypane.png&quot; alt=&quot;Polypane showing three different devices side-by-side.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Ignore JavaScript code to ease debugging</title>
    <link href="https://devtoolstips.org/tips/en/ignore-scripts/"/>
    <updated>2022-10-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/ignore-scripts/</id>
    <content type="html">&lt;p&gt;Debugging JavaScript can quickly get out of hand when you have a lot of code and many functions that call each other.&lt;/p&gt;
&lt;p&gt;What&#39;s even worse is when a lot of this code isn&#39;t even yours. This can happen when you use frameworks or libraries. You don&#39;t really want to debug the library code, but sometimes it gets in the way when trying to step through your own code while using breakpoints.&lt;/p&gt;
&lt;p&gt;To help with this, you can ignore third-party scripts (like library source files) in DevTools. When ignored, those files don&#39;t appear in your callstacks when debugging, and you don&#39;t step through them anymore.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To ignore a script in Chrome or Edge: right-click anywhere in the file and click &lt;strong&gt;Add script to ignore list&lt;/strong&gt;. Learn more on the &lt;a href=&quot;https://developer.chrome.com/docs/devtools/javascript/reference/#ignore-list&quot;&gt;Chrome docs&lt;/a&gt; or the &lt;a href=&quot;https://learn.microsoft.com/microsoft-edge/devtools-guide-chromium/javascript/reference#ignore-a-script-or-pattern-of-scripts&quot;&gt;Edge docs&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;In Firefox: right-click in the file and click &lt;strong&gt;Ignore source&lt;/strong&gt;. Or click the &lt;strong&gt;Ignore source&lt;/strong&gt; button in the bottom left corner of the file (&lt;a href=&quot;https://firefox-source-docs.mozilla.org/devtools-user/debugger/how_to/ignore_a_source/index.html&quot;&gt;learn more&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In Firefox, you can go even further than this and ignore parts of a script only. Maybe you have a utility function in your file that gets called over and over again but isn&#39;t related to what you&#39;re trying to debug.&lt;/p&gt;
&lt;p&gt;To ignore part of script only in Firefox:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select the code you want to ignore.&lt;/li&gt;
&lt;li&gt;Right-click the select and click &lt;strong&gt;Ignore lines&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/ignore-scripts.png&quot; alt=&quot;Firefox ignore line contextual menu option, displayed on a few lines of selected JavaScript code.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit JavaScript functions while debugging to test a quick fix</title>
    <link href="https://devtoolstips.org/tips/en/edit-javascript-while-debugging/"/>
    <updated>2022-10-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-javascript-while-debugging/</id>
    <content type="html">&lt;p&gt;Sometimes, when debugging JavaScript code in DevTools, you may want to test a quick change and see whether that fixes the bug.&lt;/p&gt;
&lt;p&gt;Usually, this involves the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Pause at a breakpoint, or an error.&lt;/li&gt;
&lt;li&gt;Look at the code and local variables to understand the problem.&lt;/li&gt;
&lt;li&gt;Go to your editor, make the change to the code, and save it.&lt;/li&gt;
&lt;li&gt;Go back to the browser, reload the page, hit the breakpoint again (which may involve doing a bunch of other steps first).&lt;/li&gt;
&lt;li&gt;Check if the fix was right.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now in Chromium-based browsers, you can test those quick fixes much faster without ever leaving DevTools:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Pause at a breakpoint, or an error.&lt;/li&gt;
&lt;li&gt;Look at the code and local variables to understand the problem.&lt;/li&gt;
&lt;li&gt;Make your change &lt;strong&gt;directly in the source shown in DevTools&lt;/strong&gt;, and press &lt;kbd&gt;Ctrl+S&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+S&lt;/kbd&gt;) to save it.&lt;/li&gt;
&lt;li&gt;The function is automatically restarted, with the new code, and you can verify your fix right away.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This means you don&#39;t need to leave DevTools, make your change to the original code, reload the page, and wait to hit the breakpoint or error again!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-javascript-while-debugging.gif&quot; alt=&quot;Animation showing that it is possible to write code in the Sources panel, while debugging, to test fixes.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Install or create extensions to customize DevTools</title>
    <link href="https://devtoolstips.org/tips/en/extend-devtools/"/>
    <updated>2022-10-14T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/extend-devtools/</id>
    <content type="html">&lt;p&gt;There&#39;s &lt;a href=&quot;https://devtoolstips.org/tips/en/extend-devtools/discover-all-tools.md&quot;&gt;a lot of tools&lt;/a&gt; in DevTools already, probably more than you use. But in some cases, you may need very specific tools that aren&#39;t available by default.&lt;/p&gt;
&lt;p&gt;Thankfully, DevTools can be extended with custom tools! You can either download extensions others have created to customize the DevTools UI, or even &lt;strong&gt;create your own&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For example, you can download the &lt;a href=&quot;https://github.com/facebook/react/tree/main/packages/react-devtools-extensions#installation&quot;&gt;React DevTools extension&lt;/a&gt; for Chrome, Firefox, or Edge.&lt;/p&gt;
&lt;p&gt;All browsers have their own extension stores where you can find other DevTools extensions: &lt;a href=&quot;https://chrome.google.com/webstore/category/extensions&quot;&gt;Chrome&lt;/a&gt;, &lt;a href=&quot;https://microsoftedge.microsoft.com/addons/Microsoft-Edge-Extensions-Home&quot;&gt;Edge&lt;/a&gt;, &lt;a href=&quot;https://addons.mozilla.org/firefox/&quot;&gt;Firefox&lt;/a&gt;, &lt;a href=&quot;https://developer.apple.com/safari/extensions/&quot;&gt;Safari&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To go further, you can create your own extensions. Here are a few links to learn about developing your own extensions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://learn.microsoft.com/microsoft-edge/extensions-chromium/developer-guide/devtools-extension&quot;&gt;Create an extension that customizes the DevTools UI&lt;/a&gt; on &lt;a href=&quot;http://learn.microsoft.com/&quot;&gt;learn.microsoft.com&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.chrome.com/docs/extensions/mv3/devtools/&quot;&gt;Extending DevTools&lt;/a&gt; on &lt;a href=&quot;http://developer.chrome.com/&quot;&gt;developer.chrome.com&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools&quot;&gt;Extending the developer tools&lt;/a&gt; on MDN.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.apple.com/documentation/safariservices/safari_web_extensions/adding_a_web_development_tool_to_safari_web_inspector&quot;&gt;Adding a web development tool to Safari Web Inspector&lt;/a&gt; on &lt;a href=&quot;http://developer.apple.com/&quot;&gt;developer.apple.com&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/extend-devtools.png&quot; alt=&quot;Microsoft Edge, with DevTools opened, showing a custom panel.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Use DevTools in another language</title>
    <link href="https://devtoolstips.org/tips/en/use-another-language/"/>
    <updated>2022-10-04T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/use-another-language/</id>
    <content type="html">&lt;p&gt;If you want to use DevTools in another language than English, you can do it across all major browsers.&lt;/p&gt;
&lt;p&gt;In Firefox, DevTools will always match the language of the browser, so if you downloaded Firefox in French for instance, then DevTools will be in French too.&lt;/p&gt;
&lt;p&gt;In Edge &amp;amp; Chrome, you can choose between English and the language the browser is in. To do so,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to Settings.&lt;/li&gt;
&lt;li&gt;Go to Languages.&lt;/li&gt;
&lt;li&gt;Add the language of your choice and select &amp;quot;Display Microsoft Edge in this language&amp;quot;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And then in DevTools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the settings (press F1 or click the cog icon).&lt;/li&gt;
&lt;li&gt;Click the &amp;quot;Match browser language&amp;quot; checkbox.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Alternatively, you can only change the language of the DevTools using the following steps,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open DevTools Settings (&lt;kbd&gt;F1&lt;/kbd&gt; or &lt;kbd&gt;Shift+?&lt;/kbd&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Preferences&lt;/strong&gt; &amp;gt; &lt;strong&gt;Appearance&lt;/strong&gt; &amp;gt; &lt;strong&gt;Language&lt;/strong&gt;. Select a language and then click &lt;strong&gt;Reload DevTools&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For Safari, you can set the app level language in MacOS by using &lt;strong&gt;System preferences&lt;/strong&gt; &amp;gt; &lt;strong&gt;Language &amp;amp; Region&lt;/strong&gt; &amp;gt; &lt;strong&gt;Apps&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Add the Safari app and choose the language. Restart Safari.  and then the browser &amp;amp; the DevTools will use the selected language.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/use-another-language.png&quot; alt=&quot;The settings panel in Edge showing a checkbox to match DevTools with the browser language.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Access results from recent Console evaluations</title>
    <link href="https://devtoolstips.org/tips/en/access-recent-console-results/"/>
    <updated>2022-09-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/access-recent-console-results/</id>
    <content type="html">&lt;p&gt;Imagine you evaluate a long expression like &lt;code&gt;$$(&#39;*&#39;).map(el =&amp;gt; Object.values(el.attributes).map(attr =&amp;gt; {return {name: attr.name, value: attr.value}}))&lt;/code&gt; which extracts the attributes from all of the DOM elements on the page.&lt;/p&gt;
&lt;p&gt;Now imagine you want to access one element in particular from the giant returned array. You could just type the same expression again and add &lt;code&gt;[14]&lt;/code&gt; at the end of it to access the 15th item.&lt;/p&gt;
&lt;p&gt;Or, you can use this great Console trick to reference the previous result without having to type it again:&lt;/p&gt;
&lt;p&gt;To access the last result just type &lt;code&gt;$_&lt;/code&gt; in the Console. In the above example, you would therefore type &lt;code&gt;$_[14]&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/access-recent-console-results-firefox.png&quot; alt=&quot;The Console in Firefox DevTools showing how using $_ refers to the previous Console result&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Safari goes even further&lt;/strong&gt; and provides shortcuts from &lt;code&gt;$1&lt;/code&gt; all the way to &lt;code&gt;$99&lt;/code&gt; to access previous results too. So if you had evaluated many expressions in the Console before, you can refer to their results by using one of the &lt;code&gt;$n&lt;/code&gt; shortcuts where &lt;code&gt;$1&lt;/code&gt; is the first evaluated expression, &lt;code&gt;$2&lt;/code&gt; is the second one, and so on (&lt;a href=&quot;https://webkit.org/web-inspector/console-command-line-api/#$1&quot;&gt;more information here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/access-recent-console-results-safari.png&quot; alt=&quot;The Console in Safari Web Inspector showing how using $1, $2, $3, ... refer to previous Console results&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Simulate a different latitude/longitude geolocation</title>
    <link href="https://devtoolstips.org/tips/en/simulate-geolocation/"/>
    <updated>2022-09-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/simulate-geolocation/</id>
    <content type="html">&lt;p&gt;If your website has features that depend on the geographic location of your users, you can test these features by simulating different geolocations right from DevTools!&lt;/p&gt;
&lt;p&gt;Chrome and Edge DevTools have a built-in way to simulate any location:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In DevTools, press &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; (or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; on mac) to open the &lt;a href=&quot;https://devtoolstips.org/tips/en/simulate-geolocation/execute-commands.md&quot;&gt;Command Menu&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Type &amp;quot;Sensors&amp;quot; in the command menu and press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Sensors&lt;/strong&gt; tool, find the &lt;strong&gt;Location&lt;/strong&gt; drop-down.&lt;/li&gt;
&lt;li&gt;Choose any of the preset locations (or create your own by clicking &lt;strong&gt;Manage&lt;/strong&gt;) and refresh the webpage.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the following screenshot, the webpage is &lt;a href=&quot;http://google.com/&quot;&gt;google.com&lt;/a&gt; and the location was set to São Paulo, Brazil. After a refresh, the &lt;a href=&quot;http://google.com/&quot;&gt;google.com&lt;/a&gt; homepage shows the text in Portuguese.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-geolocation.png&quot; alt=&quot;Chrome, showing Google in Portuguese, with DevTools opened to the side and the Sensors tool showing that the geolocation was set to São Paulo.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find inactive CSS styles</title>
    <link href="https://devtoolstips.org/tips/en/find-inactive-styles/"/>
    <updated>2022-09-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-inactive-styles/</id>
    <content type="html">&lt;p&gt;Sometimes we write CSS code that&#39;s entirely valid but has absolutely no effect at all, and this can be frustrating.&lt;/p&gt;
&lt;p&gt;Indeed, there are many cases where a CSS declaration has no effect on an element. One common example is using &lt;code&gt;width&lt;/code&gt; on an inline element. While this example may be known to most, there are so many different CSS properties and possible ways to combine them that it&#39;s impossible to know all of the cases where CSS won&#39;t have any effect.&lt;/p&gt;
&lt;p&gt;Firefox innovated with very cool feature that helps find these &amp;quot;inactive&amp;quot; CSS properties, and Chromium-based browsers now also have something!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In Firefox&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select an element in the &lt;strong&gt;Inspector&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Look at its applied styles in the &lt;strong&gt;Rules&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Inactive properties are greyed out and have an information icon next to them.&lt;/li&gt;
&lt;li&gt;Hover over the information icon to know why the property is inactive.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-inactive-styles.png&quot; alt=&quot;Part of the Rules panel in Firefox, showing a greyed out flex-grow property, with a tooltip saying that the property is inactive because the selected element is not a flex item.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In Chrome or Edge&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make sure the feature is enabled:
&lt;ul&gt;
&lt;li&gt;Use Chrome or Edge 106 or later.&lt;/li&gt;
&lt;li&gt;In DevTools go to the Settings (press &lt;kbd&gt;F1&lt;/kbd&gt;).&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Experiments&lt;/strong&gt; tab, enable the &lt;strong&gt;Enable CSS Authoring hints for inactive rules, deprecated properties, etc.&lt;/strong&gt; checkbox, close the Settings, and reload DevTools when prompted.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Select an element in the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Look at its applied styles in the &lt;strong&gt;Styles&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Inactive properties have an information icon next to them. If you see one, that means an authoring hint is available for this property.&lt;/li&gt;
&lt;li&gt;Hover over the icon to reveal the tooltip with information about the property.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-inactive-styles-chromium.png&quot; alt=&quot;Part of the Styles panel in Chrome, showing a greyed out align-content property, with a tooltip saying that the property is inactive because the selected flex container is not set to wrap.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: this is not an audit tool! It won&#39;t help you remove useless CSS rules throughout your codebase. Its value is when inspecting specific elements only, to easily detect when a given CSS property isn&#39;t doing anything on it.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Get the recently selected DOM nodes in the console</title>
    <link href="https://devtoolstips.org/tips/en/get-recently-selected-dom-nodes-in-console/"/>
    <updated>2022-08-31T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/get-recently-selected-dom-nodes-in-console/</id>
    <content type="html">&lt;p&gt;If you type &lt;code&gt;$0&lt;/code&gt; in the &lt;strong&gt;Console&lt;/strong&gt; tool, in any browser, the currently selected DOM node is returned. This is very handy. To learn more, check &lt;a href=&quot;https://devtoolstips.org/tips/en/get-recently-selected-dom-nodes-in-console/get-current-element-in-console.md&quot;&gt;Get the selected element in the console&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On top of this, in Edge, Polypane and Chrome, the &lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt;, &lt;code&gt;$3&lt;/code&gt;, and &lt;code&gt;$4&lt;/code&gt; shortcuts are also defined!&lt;/p&gt;
&lt;p&gt;They can be used to access the recently selected DOM nodes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$1&lt;/code&gt; returns the DOM node you selected just before the currently selected one.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$2&lt;/code&gt; returns the DOM node you selected before that.&lt;/li&gt;
&lt;li&gt;And so on!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/get-recently-selected-dom-nodes-in-console.gif&quot; alt=&quot;Chrome DevTools, with the Elements and Console tools shown. 5 DOM nodes are selected, one after the other, and then the $0, $1, $2, $3, and $4 shortcuts are used in the Console, showing how they refer to the previously selected DOM nodes.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Inspect CSS animations</title>
    <link href="https://devtoolstips.org/tips/en/inspect-css-animations/"/>
    <updated>2022-08-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/inspect-css-animations/</id>
    <content type="html">&lt;p&gt;Modern browser DevTools provide a handy tool to inspect and modify CSS animations, CSS transitions, and Web animations. These tools not only help you debug animations, but also let you modify the various animation properties.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;For Chromium browsers (Chrome/Edge)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Open the &lt;a href=&quot;https://devtoolstips.org/tips/en/inspect-css-animations/execute-commands.md&quot;&gt;Command Menu&lt;/a&gt; (&lt;code&gt;Cmd+Shift+P&lt;/code&gt; or &lt;code&gt;Ctrl+Shift+P&lt;/code&gt;), type &amp;quot;Show Animations&amp;quot;, and press Enter.&lt;br /&gt;
This will open the &lt;strong&gt;Animations&lt;/strong&gt; tool.&lt;/p&gt;
&lt;p&gt;Next, trigger an animation in the webpage to record it in the tool. The &lt;strong&gt;Animations&lt;/strong&gt; tool is divided into 4 sections:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Controls&lt;/strong&gt;: From here, you can clear all currently captured animation groups, or change the speed of the currently selected animation group.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Select an animation group here to inspect and modify it in the Details pane.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Timeline&lt;/strong&gt;: Pause and start an animation from here, or jump to a specific point in the animation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Details&lt;/strong&gt;: Inspect and modify the currently selected animation group like adding delay or changing timing duration.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;For Firefox&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Inspect an element that uses an animation in the &lt;strong&gt;Inspector&lt;/strong&gt; tool (or a parent of that element) and open the &lt;strong&gt;Animations&lt;/strong&gt; pane from the right sidebar.&lt;/p&gt;
&lt;p&gt;Next, trigger the animation to view its timeline in the &lt;strong&gt;Animations&lt;/strong&gt; pane.&lt;/p&gt;
&lt;p&gt;Use the draggable vertical line to scrub through the timeline or jump to a specific point. You can also change the playback speed and do much &lt;a href=&quot;https://firefox-source-docs.mozilla.org/devtools-user/page_inspector/how_to/work_with_animations/index.html&quot;&gt;more&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/inspect-css-animation.gif&quot; alt=&quot;Animation of Chrome DevTools showing how to inspect and modify CSS animations using the Animation inspector.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Remove annoying page overlays and other elements</title>
    <link href="https://devtoolstips.org/tips/en/remove-annoying-overlays/"/>
    <updated>2022-08-09T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/remove-annoying-overlays/</id>
    <content type="html">&lt;p&gt;A lot of websites these days get covered with overlays and crammed with lots of ads and other things that make it hard to just read the content of the page.&lt;/p&gt;
&lt;p&gt;To get rid of an annoying overlay, or any other element for that matter:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools (press &lt;kbd&gt;F12&lt;/kbd&gt;).&lt;/li&gt;
&lt;li&gt;Start the inspect tool by clicking the pointer icon in the DevTools toolbar.&lt;/li&gt;
&lt;li&gt;On the webpage, select the element which you want to remove. As you hover elements, they will get highlighted. Use this highlight to make sure you&#39;re selecting the right element.&lt;/li&gt;
&lt;li&gt;Now, with the element selected in the &lt;strong&gt;Inspector&lt;/strong&gt;/&lt;strong&gt;Elements&lt;/strong&gt; panel, just press &lt;kbd&gt;Delete&lt;/kbd&gt; on your keyboard to remove the element.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/remove-annoying-overlays.gif&quot; alt=&quot;Animation showing the whole flow from selecting the element with the inspect tool and pressing delete, resulting in the element disappearing from the page.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Credits go to &lt;a href=&quot;https://christianheilmann.com/&quot;&gt;Chris Heilmann&lt;/a&gt; for this tip and other cool DevTools tips for non-developers, which you can find here: &lt;a href=&quot;https://codepo8.github.io/web-cheatcodes/&quot;&gt;web cheatcodes&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Copy CSS selector of an element</title>
    <link href="https://devtoolstips.org/tips/en/copy-css-selector/"/>
    <updated>2022-07-26T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/copy-css-selector/</id>
    <content type="html">&lt;p&gt;To uniquely identify an element that lacks an identifier, so that you can reference the element in JavaScript and other places, use DevTools&#39; ability to copy unique CSS selectors.&lt;/p&gt;
&lt;p&gt;All DevTools have the option to build a unique CSS selector for an element and then copy it to the clipboard:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Chrome&lt;/strong&gt; and &lt;strong&gt;Edge&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;In the &lt;strong&gt;Elements&lt;/strong&gt; tool, right-click an element, and then select &lt;code&gt;Copy&lt;/code&gt; &amp;gt; &lt;code&gt;Copy selector&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Firefox&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;In the &lt;strong&gt;Inspector&lt;/strong&gt; tool, right-click an element, and then select &lt;code&gt;Copy&lt;/code&gt; &amp;gt; &lt;code&gt;CSS Selector&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Safari&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;In the &lt;strong&gt;Elements&lt;/strong&gt; tool, right-click an element, and then select &lt;code&gt;Copy&lt;/code&gt; &amp;gt; &lt;code&gt;Selector Path&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Polypane&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;In the &lt;strong&gt;Elements&lt;/strong&gt; panel, right-click an element, and then select &lt;code&gt;Copy Selector&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This copies a unique CSS selector for the element, which you can then use in your JavaScript code, for example, to reference the element:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;#maincontent &gt; div &gt; h2&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-css-selector.png&quot; alt=&quot;Edge DevTools, showing how to access the Copy CSS selector option.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Copy an element&#39;s JavaScript path</title>
    <link href="https://devtoolstips.org/tips/en/copy-element-js-path/"/>
    <updated>2022-07-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/copy-element-js-path/</id>
    <content type="html">&lt;p&gt;JavaScript often needs references to DOM nodes on the page. Getting a reference is sometimes easy with &lt;code&gt;document.getElementById()&lt;/code&gt; or similar. Other times however, a more complicated CSS selector needs to be created and used with &lt;code&gt;document.querySelector()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To automatically get the right JavaScript expression to use for any node:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Find the node you are interested in in the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Right-click the node and select &lt;strong&gt;Copy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copy JS path&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The right &lt;code&gt;document.querySelector()&lt;/code&gt; expression is now in your clipboard. You can paste it anywhere you need it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-element-js-path.png&quot; alt=&quot;The Elements tool in Edge showing the context menu on an element, with the Copy JS path option.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Jump from a label `for` attribute to the linked input (and more)</title>
    <link href="https://devtoolstips.org/tips/en/jump-to-referenced-elements/"/>
    <updated>2022-07-01T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/jump-to-referenced-elements/</id>
    <content type="html">&lt;p&gt;In HTML, it&#39;s possible for certain attributes to reference other elements by their IDs. For example, a &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt;&#39;s &lt;code&gt;for&lt;/code&gt; attribute can be used to link the label to the input it&#39;s associated with:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;foo&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Label&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;input&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;foo&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Other cases of attributes referencing the ID of other elements include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;button form=&amp;quot;formID&amp;quot;&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;input list=&amp;quot;datalistID&amp;quot;&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;td headers=&amp;quot;header1ID,header2ID&amp;quot;&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In DevTools, to jump from an element that references another element&#39;s ID attribute, to that other element, use the following steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox, in the &lt;strong&gt;Inspector&lt;/strong&gt; tool: hold &lt;kbd&gt;Cmd&lt;/kbd&gt; on MacOS or &lt;kbd&gt;Ctrl&lt;/kbd&gt; on Windows or Linux, and then click the attribute.&lt;/li&gt;
&lt;li&gt;In Polypane, in the &lt;strong&gt;Elements&lt;/strong&gt; panel: click the attribute.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The referenced element is selected in the DOM tree.&lt;/p&gt;
&lt;p&gt;In the above &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt;/&lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; example, using the above steps on the &lt;code&gt;foo&lt;/code&gt; value of the &lt;code&gt;for&lt;/code&gt; attribute selects the &lt;code&gt;input&lt;/code&gt; element.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/jump-to-referenced-elements.gif&quot; alt=&quot;Animation showing the Firefox DevTools Inspector panel, the mouse clicks the for attribute of a label element and the selection jumps to the related input element.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Thank you to &lt;a href=&quot;https://twitter.com/mmatuzo&quot;&gt;Manuel Matuzović&lt;/a&gt; for &lt;a href=&quot;https://twitter.com/mmatuzo/status/1542768792836636672&quot;&gt;sharing on twitter&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Fix color contrast issues using the element tooltip</title>
    <link href="https://devtoolstips.org/tips/en/fix-color-contrast-issues-with-element-tooltip/"/>
    <updated>2022-06-30T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/fix-color-contrast-issues-with-element-tooltip/</id>
    <content type="html">&lt;p&gt;There are multiple ways to detect and fix color contrast issues with DevTools, but here is a nice one to keep in mind. It&#39;s not straightforward to use and takes a few steps, but makes it very nice to see the resulting contrast ratio as you change the color value.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a href=&quot;https://twitter.com/argyleink&quot;&gt;Adam Argyle&lt;/a&gt; for &lt;a href=&quot;https://twitter.com/argyleink/status/1255236249255845892&quot;&gt;sharing this on Twitter&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Styles&lt;/strong&gt; panel, click on the color value you want to change, to focus the field.&lt;/li&gt;
&lt;li&gt;Press &lt;kbd&gt;Ctrl+Shift+C&lt;/kbd&gt; (or &lt;kbd&gt;Cmd+Shift+C&lt;/kbd&gt; on Mac) to start the inspect tool.&lt;/li&gt;
&lt;li&gt;Position your mouse over the element which you are changing the color for. Don&#39;t click anywhere, we want to keep the color value field focused, just hover over the element so the element tooltip appears.&lt;/li&gt;
&lt;li&gt;Now change the color value with the keyboard and check the contrast ratio in the tooltip as you do so.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/fix-color-contrast-issues-with-element-tooltip.gif&quot; alt=&quot;Animation of the Elements panel in Microsoft Edge. User clicks on color value, then activates the inspect tool, then hovers over an element on the page, then uses the arrow keys to change the color. We see the element tooltip showing the background and text colors as well as the resulting contrast.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Related tips:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://devtoolstips.org/tips/en/fix-color-contrast-issues-with-element-tooltip/detect-low-color-contrast.md&quot;&gt;Detect low color contrast issues&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://devtoolstips.org/tips/en/fix-color-contrast-issues-with-element-tooltip/fix-color-contrast-issues.md&quot;&gt;Fix low color contrast issues&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Empty the cache and hard refresh</title>
    <link href="https://devtoolstips.org/tips/en/empty-cache-refresh/"/>
    <updated>2022-06-14T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/empty-cache-refresh/</id>
    <content type="html">&lt;p&gt;Here is a nice tip to quickly empty your cache and refresh the page, in order to test new code changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Chrome, or Edge, open DevTools (&lt;kbd&gt;F12&lt;/kbd&gt;). This step is not needed for Polypane.&lt;/li&gt;
&lt;li&gt;Right-click on the page refresh icon, in the browser toolbar.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Empty cache and hard refresh&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/empty-cache-refresh.png&quot; alt=&quot;The Microsoft Edge browser toolbar, showing the contextual menu of the refresh button, with the empty cache and hard refresh menu item.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Quickly spot out-of-viewport elements</title>
    <link href="https://devtoolstips.org/tips/en/spot-out-of-viewport-elements/"/>
    <updated>2022-06-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/spot-out-of-viewport-elements/</id>
    <content type="html">&lt;p&gt;Sometimes, either by accident or on purpose, HTML elements end up outside of the visible browser viewport. When they do, it can be really hard to find them in DevTools. Indeed, the DOM tree in the &lt;strong&gt;Elements&lt;/strong&gt; tool is nice and all, but it&#39;s not super easy to navigate especially when it&#39;s huge and deeply nested.&lt;/p&gt;
&lt;p&gt;Here&#39;s a nice tip to quickly find out-of-viewport elements, by using the &lt;strong&gt;3D View&lt;/strong&gt; tool in Edge DevTools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open DevTools in Microsoft Edge (press &lt;kbd&gt;F12&lt;/kbd&gt;).&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;3D View&lt;/strong&gt; tool by clicking the &lt;strong&gt;More tools&lt;/strong&gt; (&lt;strong&gt;+&lt;/strong&gt;) button in the toolbar at the top and choosing &lt;strong&gt;3D View&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the left sidebar, choose the &lt;strong&gt;DOM&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Zoom and pan the 3D scene to find out of viewport elements!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/spot-out-of-viewport-elements.png&quot; alt=&quot;Edge DevTools showing the Elements tool at the top with the DOM tree and the 3D View tool at the bottom, showing a 3D render of the page, with most elements in the same rectangle, and 2 smaller elements outside of the main rectangle.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit an element&#39;s attributes and tag name with the keyboard</title>
    <link href="https://devtoolstips.org/tips/en/edit-elements-with-the-keyboard/"/>
    <updated>2022-05-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-elements-with-the-keyboard/</id>
    <content type="html">&lt;p&gt;Using the keyboard can be faster than using a mouse in certain cases (and for some people). One such case is editing an element&#39;s tag name and attributes in DevTools.&lt;/p&gt;
&lt;p&gt;To do this, select an element in the &lt;strong&gt;Elements&lt;/strong&gt; tool (called &lt;strong&gt;Inspector&lt;/strong&gt; in Firefox) and:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Press &lt;kbd&gt;Enter&lt;/kbd&gt; to start the editing mode. The first attribute of the element becomes editable with the keyboard! (Note: on Firefox, the tag name becomes editable first).&lt;/li&gt;
&lt;li&gt;After you have made the necessary changes, you can:
&lt;ul&gt;
&lt;li&gt;Either press &lt;kbd&gt;Enter&lt;/kbd&gt; again to commit the change.&lt;/li&gt;
&lt;li&gt;Or, press &lt;kbd&gt;Tab&lt;/kbd&gt; or &lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;Tab&lt;/kbd&gt; to move to the next or previous attribute, or the tag name if there are no other attributes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-elements-with-the-keyboard.gif&quot; alt=&quot;Animation of a part of the Inspector panel in Firefox, showing how pressing Enter on a focused element goes into edit mode and how Tab allows to navigate from field to field.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Create your own simulated devices</title>
    <link href="https://devtoolstips.org/tips/en/add-new-devices/"/>
    <updated>2022-05-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/add-new-devices/</id>
    <content type="html">&lt;p&gt;You can simulate various different devices from DevTools, to get an idea of how your webpage might render on those devices (note that this is only a simulation, the tool only changes the screen dimensions, touch event handling, and user agent string, but ultimately, the rendering of the webpage is still done by the browser you are using).&lt;/p&gt;
&lt;p&gt;But what&#39;s even better, is that you can create your own simulated devices. This is useful if what&#39;s available in the list isn&#39;t enough for you. Here&#39;s how:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open DevTools (press &lt;kbd&gt;F12&lt;/kbd&gt;), and start the device mode (on Edge and Chrome, click the &lt;strong&gt;Toggle device emulation&lt;/strong&gt; button, on Firefox, click &lt;strong&gt;Responsive Design Mode&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;In the device simulation screen, expand the device drop-down and click &lt;strong&gt;Edit...&lt;/strong&gt;. The device customization screen appears.&lt;/li&gt;
&lt;li&gt;From this screen, you can check or uncheck devices to customize the device drop-down, and you can click &lt;strong&gt;Add Custom Device...&lt;/strong&gt; to add your own devices.&lt;/li&gt;
&lt;li&gt;Choose a device name, dimensions, dpr, and user agent string, and submit. Your new device should now be available in the device drop-down!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/add-new-devices.gif&quot; alt=&quot;Animation of the device mode in Firefox, showing how to customize the list of devices, including adding custom devices.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In Polypane these steps are not needed. Double-click anywhere to add a new device and configure its settings from the &lt;strong&gt;Emulation options&lt;/strong&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Discover all the tools</title>
    <link href="https://devtoolstips.org/tips/en/discover-all-tools/"/>
    <updated>2022-05-13T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/discover-all-tools/</id>
    <content type="html">&lt;p&gt;DevTools is confusing! There&#39;s so much functionality packed in such a small UI. Did you know that Chrome DevTools had more than 30 individual tools! Yes, that&#39;s right, 30.&lt;/p&gt;
&lt;p&gt;It&#39;s hard for both new users and more experienced users. New users may feel overwhelmed, and more experienced users will tend to stay in the same few tools and not know that others exist.&lt;/p&gt;
&lt;p&gt;So here is a list of all the panels available in DevTools, per browser! Want to test your knowledge? Play &lt;a href=&quot;https://patrickbrosset.com/lab/2022-05-13-whats-that-tool/&quot;&gt;What&#39;s That Tool?&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Firefox&lt;/strong&gt;  (📕&lt;a href=&quot;https://firefox-source-docs.mozilla.org/devtools-user/index.html&quot;&gt;Docs&lt;/a&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;: Navigate the internal accessibility tree that assistive technology uses to present web pages to users.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Application&lt;/strong&gt;: Debug Service Workers and Web App Manifests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Console&lt;/strong&gt;: View log messages, errors, and execute JavaScript expressions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debugger&lt;/strong&gt;: Debug JavaScript code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DOM&lt;/strong&gt;: Navigate the list of DOM properties on the page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Inspector&lt;/strong&gt;: View the DOM tree, authored and computed styles, edit CSS, and get layout information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt;: Capture and navigate memory snapshots of the current page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network&lt;/strong&gt;: View network traffic on the page and inspect individual HTTP requests and responses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt;: Measure the runtime performance of the page and understand bottlenecks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Storage&lt;/strong&gt;: View and edit cookies, local storage, cache, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Style editor&lt;/strong&gt;: Edit stylesheets on the page and create new ones.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Chrome&lt;/strong&gt; (📕&lt;a href=&quot;https://developer.chrome.com/docs/devtools/overview/&quot;&gt;Docs&lt;/a&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Animations&lt;/strong&gt;: View and edit CSS animations, transitions, and Web Animations API animations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Application&lt;/strong&gt;: Debug your PWA Service Workers, Web Apps Manifest. View and edit IndexedDB, local storage, cache. Debug background services such as notifications and background sync.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Changes&lt;/strong&gt;: See all the CSS changes you made on the page in DevTools.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Console&lt;/strong&gt;: View log messages, errors, and execute JavaScript expressions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Coverage&lt;/strong&gt;: Generate code coverage reports for JavaScript and CSS to detect how much code is used.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS overview&lt;/strong&gt;: Get a summary of the CSS styles on the page, including colors, contrast ratio, and fonts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Developer resources&lt;/strong&gt;: &lt;em&gt;missing, please help by editing &lt;a href=&quot;https://github.com/captainbrosset/devtools-tips/blob/main/src/tips/en/discover-all-tools.md&quot;&gt;this file&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Elements&lt;/strong&gt;: View the DOM tree, authored and computed styles, edit CSS, and get layout information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Issues&lt;/strong&gt;: Detect common issues with your webpage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Javascript profiler&lt;/strong&gt;: Record JavaScript code execution on the page for some time and then view time spent in each function.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Layers&lt;/strong&gt;: See the various compositing layers the browser engine created based on your page&#39;s DOM and CSS code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lighthouse&lt;/strong&gt;: Run &lt;a href=&quot;https://developers.google.com/web/tools/lighthouse/&quot;&gt;Lighthouse&lt;/a&gt; audits on your page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Media&lt;/strong&gt;: &lt;em&gt;missing, please help by editing &lt;a href=&quot;https://github.com/captainbrosset/devtools-tips/blob/main/src/tips/en/discover-all-tools.md&quot;&gt;this file&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt;: Capture memory snapshot of the current page and understand what retains objects in memory.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory inspector&lt;/strong&gt;: Inspector JavaScript ArrayBuffers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network&lt;/strong&gt;: View network traffic on the page and inspect individual HTTP requests and responses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network conditions&lt;/strong&gt;: Modify certain network conditions such as cache, speed, and user-agent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network request blocking&lt;/strong&gt;: Define custom patterns for URLs you want to block.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt;: Analyze your page&#39;s runtime performance, including CPU usage, GPU activity, memory usage, refresh rate, user interactions, layout and graphic engine operations, and more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance insights&lt;/strong&gt;: Get actionable performance insights about your page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance monitor&lt;/strong&gt;: Monitor your page&#39;s performance live with CPU usage, memory size, DOM node numbers, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Protocol monitor&lt;/strong&gt;: Monitor the CDP (Chrome DevTools Protocol) traffic that DevTools relies on to debug your page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quick source&lt;/strong&gt;: A simpler version of the Sources panel.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recorder&lt;/strong&gt;: Record user scenarios in the tab, and easily replay them automatically.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rendering&lt;/strong&gt;: Emulate different rendering modes: media features, color vision deficiencies, and more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Search&lt;/strong&gt;: Search within the resources loaded on the page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security&lt;/strong&gt;: Get an overview of the page&#39;s security aspects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sensors&lt;/strong&gt;: Simulate device location, orientation and touch events.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sources&lt;/strong&gt;: View the currently loaded resources on the page, edit stylesheets, and debug JavaScript code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Web audio&lt;/strong&gt;: View the audio node graph.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Webauthn&lt;/strong&gt;: Create virtual authentication environments to debug your web authentication flows.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What&#39;s new&lt;/strong&gt;: Get highlights from the most recent DevTools update.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Edge&lt;/strong&gt; (📕&lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/landing/&quot;&gt;Docs&lt;/a&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;3D view&lt;/strong&gt;: View your page&#39;s DOM, z-index stacking, or layers tree in 3D.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Animations&lt;/strong&gt;: View and edit CSS animations, transitions, and Web Animations API animations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Application&lt;/strong&gt;: Debug your PWA Service Workers, Web Apps Manifest. View and edit IndexedDB, local storage, cache. Debug background services such as notifications and background sync.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Changes&lt;/strong&gt;: See all the CSS changes you made on the page in DevTools.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Console&lt;/strong&gt;: View log messages, errors, and execute JavaScript expressions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Coverage&lt;/strong&gt;: Generate code coverage reports for JavaScript and CSS to detect how much code is used.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Css overview&lt;/strong&gt;: Get a summary of the CSS styles on the page, including colors, contrast ratio, and fonts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Detached elements&lt;/strong&gt;: Find DOM elements in memory that are no longer attached to the DOM, and record heap snapshots to find what retains them.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Developer resources&lt;/strong&gt;: &lt;em&gt;missing, please help by editing &lt;a href=&quot;https://github.com/captainbrosset/devtools-tips/blob/main/src/tips/en/discover-all-tools.md&quot;&gt;this file&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Elements&lt;/strong&gt;: View the DOM tree, authored and computed styles, edit CSS, and get layout information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Issues&lt;/strong&gt;: Detect common issues with your webpage. The issues are powered by &lt;a href=&quot;https://webhint.io/&quot;&gt;webhint&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Javascript profiler&lt;/strong&gt;: Record JavaScript code execution on the page for some time and then view time spent in each function.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Layers&lt;/strong&gt;: See the various compositing layers the browser engine created based on your page&#39;s DOM and CSS code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lighthouse&lt;/strong&gt;: Run &lt;a href=&quot;https://developers.google.com/web/tools/lighthouse/&quot;&gt;Lighthouse&lt;/a&gt; audits on your page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Media&lt;/strong&gt;: &lt;em&gt;missing, please help by editing &lt;a href=&quot;https://github.com/captainbrosset/devtools-tips/blob/main/src/tips/en/discover-all-tools.md&quot;&gt;this file&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt;: Capture memory snapshot of the current page and understand what retains objects in memory.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory inspector&lt;/strong&gt;: Inspector JavaScript ArrayBuffers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network&lt;/strong&gt;: View network traffic on the page and inspect individual HTTP requests and responses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network conditions&lt;/strong&gt;: Modify certain network conditions such as cache, speed, and user-agent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network console&lt;/strong&gt;: Create and manage your API requests and test them whenever you want.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network request blocking&lt;/strong&gt;: Define custom patterns for URLs you want to block.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt;: Analyze your page&#39;s runtime performance, including CPU usage, GPU activity, memory usage, refresh rate, user interactions, layout and graphic engine operations, and more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance monitor&lt;/strong&gt;: Monitor your page&#39;s performance live with CPU usage, memory size, DOM node numbers, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Protocol monitor&lt;/strong&gt;: Monitor the CDP (Chrome DevTools Protocol) traffic that DevTools relies on to debug your page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quick source&lt;/strong&gt;: A simpler version of the Sources panel.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recorder&lt;/strong&gt;: Record user scenarios in the tab, and easily replay them automatically.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rendering&lt;/strong&gt;: Emulate different rendering modes: media features, color vision deficiencies, and more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Search&lt;/strong&gt;: Search within the resources loaded on the page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security&lt;/strong&gt;: Get an overview of the page&#39;s security aspects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sensors&lt;/strong&gt;: Simulate device location, orientation and touch events.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Source maps monitor&lt;/strong&gt;: Check where source maps are downloaded from.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sources&lt;/strong&gt;: View the currently loaded resources on the page, edit stylesheets, and debug JavaScript code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Webaudio&lt;/strong&gt;: View the audio node graph.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Webauthn&lt;/strong&gt;: Create virtual authentication environments to debug your web authentication flows.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Welcome&lt;/strong&gt;: Get help, resources, and latest news.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Safari&lt;/strong&gt; (📕&lt;a href=&quot;https://webkit.org/web-inspector/&quot;&gt;Docs&lt;/a&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Elements&lt;/strong&gt;: View the DOM tree, authored and computed styles, edit CSS, and get layout information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Console&lt;/strong&gt;: View log messages, errors, and execute JavaScript expressions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sources&lt;/strong&gt;: View the currently loaded resources on the page, edit stylesheets, and debug JavaScript code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network&lt;/strong&gt;: View network traffic on the page and inspect individual HTTP requests and responses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Timelines&lt;/strong&gt;: Record performance profiles on your page and visualize network requests, layout and rendering operations, user events and JavaScript execution, and CPU usage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Storage&lt;/strong&gt;: View and edit local storage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Graphics&lt;/strong&gt;: &lt;em&gt;missing, please help by editing &lt;a href=&quot;https://github.com/captainbrosset/devtools-tips/blob/main/src/tips/en/discover-all-tools.md&quot;&gt;this file&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Layers&lt;/strong&gt;: See the various compositing layers the browser engine created based on your page&#39;s DOM and CSS code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audit&lt;/strong&gt;: Run audits on the page.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Polypane&lt;/strong&gt; (📕&lt;a href=&quot;https://polypane.app/docs/&quot;&gt;Docs&lt;/a&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Meta&lt;/strong&gt;: An overview of all meta data, robots.txt, structured data, webmanifest and social media previews&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Outline&lt;/strong&gt;: View the heading, landmark, image, link outlines, as well as the focus order of the page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Storage&lt;/strong&gt;: An overview of the localstorage, sessionstorage and cookies of the page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;: Run an automated accessibility scan.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Source&lt;/strong&gt;: Show a formatted version of the HTML source of the page along with HTML validation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Elements&lt;/strong&gt;: View the DOM tree, authored and computed styles, edit CSS, get layout and accessibility information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Console&lt;/strong&gt;: View log messages, errors, and execute JavaScript expressions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Live CSS&lt;/strong&gt;: Inject CSS into the current page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devtools&lt;/strong&gt;: Access the regular Chromium devtools. &lt;em&gt;(See above)&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Browse&lt;/strong&gt;: Open a second URL along your main one&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Workspaces&lt;/strong&gt;: Save and restore different sets of devices to test on.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/discover-all-tools.png&quot; alt=&quot;The list of most tools in Edge DevTools, just to illustrate how many there are&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Copy an elements styles</title>
    <link href="https://devtoolstips.org/tips/en/copy-element-styles/"/>
    <updated>2022-05-11T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/copy-element-styles/</id>
    <content type="html">&lt;p&gt;You can extract all the styles of an element in one go by using the &lt;strong&gt;Copy styles&lt;/strong&gt; feature.&lt;/p&gt;
&lt;p&gt;No need to go through all CSS rules and properties that apply to the element in the &lt;strong&gt;Styles&lt;/strong&gt; pane, and manually build the resulting list. With this feature, you can get the whole list at once, with all of the needed styles:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select the element you want to extract the styles from by right-clicking on it and choosing &lt;strong&gt;Inspect&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Elements&lt;/strong&gt; tool, right-click the selected element.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Copy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copy styles&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Paste the result in a text editor and use however you want.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-element-styles.png&quot; alt=&quot;The Edge DevTools Elements panel, showing the context menu on an element and the Copy styles menu item. The screenshot also shows what the result of copying styles is: a flat list of CSS properties and values.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In Polypane,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select the element you want to extract the styles from by right-clicking on it and choosing &lt;strong&gt;Inspect&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Elements Panel&lt;/strong&gt; go to the &lt;strong&gt;Computed&lt;/strong&gt; tab&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Copy Styles&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Paste the result in a text editor and use however you want.&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  
  <entry>
    <title>Use document.designMode to spell check your webpage</title>
    <link href="https://devtoolstips.org/tips/en/use-designmode-to-spell-check/"/>
    <updated>2022-05-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/use-designmode-to-spell-check/</id>
    <content type="html">&lt;p&gt;&lt;a href=&quot;https://twitter.com/AmeliasBrain&quot;&gt;Amelia Bellamy-Royds&lt;/a&gt; shared a &lt;a href=&quot;https://twitter.com/AmeliasBrain/status/1521146127327801345&quot;&gt;really cool tip&lt;/a&gt; to spell-check a webpage&#39;s content from DevTools:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open DevTools, and go to the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;document.designMode = &amp;quot;on&amp;quot;&lt;/code&gt; and press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Click somewhere on the webpage.&lt;/li&gt;
&lt;li&gt;The browser now highlights the misspelled words in red!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/use-designmode-to-spell-check.png&quot; alt=&quot;Edge, with DevTools opened on the side. The designMode trick was used in the Console, and the webpage shows a lot of red squiggly lines&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Visualize and debug CSS cascade layers</title>
    <link href="https://devtoolstips.org/tips/en/debug-css-cascade-layers/"/>
    <updated>2022-04-20T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-css-cascade-layers/</id>
    <content type="html">&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Cascade_layers&quot;&gt;Cascade layers&lt;/a&gt; is a CSS feature that allows web developers to define their CSS styles in multiple layers and control the order in which these layers apply. Cascade layers are meant to bring an elegant solution to problems we&#39;ve historically been fixing by using &lt;code&gt;!important&lt;/code&gt; or artificially making selectors have higher specificity. To learn more about cascade layers, check out &lt;a href=&quot;https://css-tricks.com/css-cascade-layers/&quot;&gt;Miriam Suzanne&#39;s complete guide on CSS Tricks&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this tip, let&#39;s see how to visualize and debug layers in DevTools. All browser DevTools have support for layers in their &lt;strong&gt;Styles&lt;/strong&gt;/&lt;strong&gt;Rules&lt;/strong&gt; panels, and some browsers have more advanced features.&lt;/p&gt;
&lt;h2 id=&quot;all-browsers&quot; tabindex=&quot;-1&quot;&gt;All browsers &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-css-cascade-layers/#all-browsers&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Open a page that uses cascade layers like &lt;a href=&quot;https://codepen.io/web-dot-dev/full/LYzqPEp&quot;&gt;this one&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Inspect an element which has styles defined in one of the cascade layers like one of the green links in the above demo.&lt;/li&gt;
&lt;li&gt;In the sidebar where CSS rules are displayed (called &lt;strong&gt;Styles&lt;/strong&gt; or &lt;strong&gt;Rules&lt;/strong&gt; depending on the browser), the rules are sorted by cascade layers, with the highest priority layer at the top, and lowest priority at the bottom.&lt;/li&gt;
&lt;li&gt;Rules that are part of a cascade layer have a &lt;code&gt;@layer &amp;lt;layername&amp;gt;&lt;/code&gt; label next to them.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-css-cascade-layers-firefox.png&quot; alt=&quot;Firefox with a demo page that uses layers, DevTools is opened and shows the Rules panel with two @layer rules&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;chrome-and-edge-only&quot; tabindex=&quot;-1&quot;&gt;Chrome and Edge only &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-css-cascade-layers/#chrome-and-edge-only&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On top of the above, Chrome and Edge have a &lt;strong&gt;Layers&lt;/strong&gt; view that shows the cascade layers in a list:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open a page that uses cascade layers like &lt;a href=&quot;https://codepen.io/web-dot-dev/full/LYzqPEp&quot;&gt;this one&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Inspect an element which has styles defined in one of the cascade layers like one of the green links in the above demo.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Toggle CSS layers view&lt;/strong&gt; button in the &lt;strong&gt;Styles&lt;/strong&gt; panel toolbar (next to the search field) to reveal the list of layers.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-css-cascade-layers-edge.png&quot; alt=&quot;Edge with a demo page that uses layers, DevTools is opened and shows the Styles panel with two @layer rules and the layers view&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;polypane-only&quot; tabindex=&quot;-1&quot;&gt;Polypane only &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/debug-css-cascade-layers/#polypane-only&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Polypane also has a &lt;strong&gt;CSS Layers&lt;/strong&gt; view that shows the cascade layers in a list:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open a page that uses cascade layers like &lt;a href=&quot;https://codepen.io/web-dot-dev/full/LYzqPEp&quot;&gt;this one&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Inspect an element which has styles defined in one of the cascade layers like one of the green links in the above demo.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;CSS Layers&lt;/strong&gt; in the &lt;strong&gt;Elements&lt;/strong&gt; panel to reveal the list of layers. The layers that are not dimmed in the list apply to the currently selected element.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-css-cascade-layers-polypane.png&quot; alt=&quot;Polypane with a demo page that uses layers, the Elements panel is open and shows three layers in the CSS Layers view, one of which is dimmed.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Automatically get issues your site has with performance, accessibility, security, compatibility, and others.</title>
    <link href="https://devtoolstips.org/tips/en/get-website-issues/"/>
    <updated>2022-04-07T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/get-website-issues/</id>
    <content type="html">&lt;p&gt;Edge has a very useful &lt;strong&gt;Issues&lt;/strong&gt; panel that can automatically list a lot of different issues with your site. It can detect common issues related to browser compatibility, accessibility, performance, security, and more.&lt;/p&gt;
&lt;p&gt;To see issues with the current page in Edge:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open DevTools (&lt;kbd&gt;F12&lt;/kbd&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;More tools&lt;/strong&gt; (&lt;code&gt;+&lt;/code&gt;) and click &lt;strong&gt;Issues&lt;/strong&gt; (you can also open the panel by using the &lt;a href=&quot;https://devtoolstips.org/tips/en/get-website-issues/execute-commands.md&quot;&gt;Command menu&lt;/a&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Issues are listed in the panel, organized by category, and severity.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;At this point, reload the page to make sure all issues are listed, as some of them depend on how your page loads over the network.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can use the toolbar at the top to filter issues too. The &lt;strong&gt;Browser&lt;/strong&gt; filter, in particular, lets you filter down the compatibility issues to just the browsers you care about.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/issues/&quot;&gt;Learn more about this tool&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/get-website-issues.png&quot; alt=&quot;The issues panel in Edge, showing many different issues about the page.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Take a screenshot of part of a webpage from the Command Menu</title>
    <link href="https://devtoolstips.org/tips/en/screenshot-part-of-page-command-menu/"/>
    <updated>2022-03-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/screenshot-part-of-page-command-menu/</id>
    <content type="html">&lt;p&gt;The &lt;a href=&quot;https://devtoolstips.org/tips/en/screenshot-part-of-page-command-menu/execute-commands.md&quot;&gt;Command menu&lt;/a&gt; in Edge and Chrome is a great way to do many of the things you can do in DevTools without having to navigate the UI.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/csaba_kissi&quot;&gt;Csaba Kissi&lt;/a&gt; shared a great tip on &lt;a href=&quot;https://twitter.com/csaba_kissi/status/1506904947631304708&quot;&gt;Twitter&lt;/a&gt; about the Command menu:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press &lt;kbd&gt;Ctrl+Shift+P&lt;/kbd&gt; on Windows or Linux (or &lt;kbd&gt;Cmd+Shift+P&lt;/kbd&gt; on mac) to open the Command menu in DevTools.&lt;/li&gt;
&lt;li&gt;Type &amp;quot;screenshot&amp;quot; to filter the list of commands.&lt;/li&gt;
&lt;li&gt;Select the screenshot command you want to use, such as &lt;strong&gt;Capture area screenshot&lt;/strong&gt; to grab a screenshot of a part of the page.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/screenshot-part-of-page-command-menu.png&quot; alt=&quot;Edge, with DevTools opened, and the Command menu showing the list of screenshot commands&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Quickly reference React components in the console</title>
    <link href="https://devtoolstips.org/tips/en/quickly-reference-react-console/"/>
    <updated>2022-03-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/quickly-reference-react-console/</id>
    <content type="html">&lt;p&gt;&lt;a href=&quot;https://twitter.com/ChatterboxDev&quot;&gt;Zee&lt;/a&gt; shared a great tip on &lt;a href=&quot;https://twitter.com/ChatterboxDev/status/1506299424712142864&quot;&gt;Twitter&lt;/a&gt; if you are working with React and have the React DevTools extension installed.&lt;/p&gt;
&lt;p&gt;You can use &lt;code&gt;$r&lt;/code&gt; in the &lt;strong&gt;Console&lt;/strong&gt; tool to reference the currently selected element in the React DevTools. This is a great way to quickly inspect the props and state of a component.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/quickly-reference-react-console.png&quot; alt=&quot;The React DevTools components panel in DevTools, and Console below it, showing the result of $r&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Start your HTML and CSS prototypes in the browser directly</title>
    <link href="https://devtoolstips.org/tips/en/prototype-in-the-browser/"/>
    <updated>2022-03-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/prototype-in-the-browser/</id>
    <content type="html">&lt;p&gt;Sometimes I need a blank canvas to prototype an idea with HTML and CSS. Something outside of the website I&#39;m working on. Maybe I need a new layout or component and I&#39;m not sure yet how to do it.&lt;/p&gt;
&lt;p&gt;In this case, starting from a blank HTML page makes a lot of sense since I don&#39;t have to worry about the rest of the site yet and only focus on my prototype.&lt;/p&gt;
&lt;p&gt;Turns out a quick way to do this is to start it directly in the browser, instead of creating a new HTML file somewhere in a &lt;code&gt;dev&lt;/code&gt; folder! Here&#39;s how I do it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I open my favorite browser and type something like this in the address bar: &lt;code&gt;data:text/html,&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This is a data URL that will tell the browser to just load the HTML content I provided after the &lt;code&gt;data:text/html,&lt;/code&gt; prefix, instead of loading a remote website.&lt;br /&gt;
I can also write more fancy HTML, maybe add more elements, and attributes. But usually just one div is enough to get me started, because my next step ...&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I immediately open DevTools and dock it to the side of the browser window.&lt;/p&gt;
&lt;p&gt;I like having it on the side because it gives me a simple way to resize the space available to my prototype by just dragging the splitter between DevTools and the page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;And then that&#39;s when the prototyping begin.&lt;/p&gt;
&lt;p&gt;Using the &lt;strong&gt;Elements&lt;/strong&gt;/&lt;strong&gt;Inspector&lt;/strong&gt; panel, I can add more elements with the &lt;strong&gt;Edit as HTML&lt;/strong&gt; feature, add and modify attributes by double-clicking them, add classes from the &lt;strong&gt;Styles&lt;/strong&gt;/&lt;strong&gt;Rules&lt;/strong&gt; panel, etc.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When I&#39;m done coding in the browser and feel like I have what I wanted, it&#39;s time to export my changes so they don&#39;t disappear when close the browser window.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To export the HTML code, I usually do this: right-click on the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element and choose &lt;strong&gt;Copy inner HTML&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To export the CSS code: in Firefox, I open the &lt;strong&gt;Changes&lt;/strong&gt; sidebar panel and click &lt;strong&gt;Copy All Changes&lt;/strong&gt; (&lt;a href=&quot;https://devtoolstips.org/tips/en/prototype-in-the-browser/find-css-changes.md&quot;&gt;learn more&lt;/a&gt;), and Chrome/Edge I go to &lt;strong&gt;Sources&lt;/strong&gt;, find the &lt;strong&gt;inspector-stylesheet&lt;/strong&gt; source and copy the content from it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/prototype-in-the-browser.png&quot; alt=&quot;Edge , with a tab opened on the HTML data-url, and DevTools opened showing the Elements and Sources panels with local changes made.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Here is a quick demo I did 4 years ago showing roughly this workflow. Things have changed a bit, but most of it still applies:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=o5wy237B5qc&quot;&gt;https://www.youtube.com/watch?v=o5wy237B5qc&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Fix low color contrast issues</title>
    <link href="https://devtoolstips.org/tips/en/fix-color-contrast-issues/"/>
    <updated>2022-03-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/fix-color-contrast-issues/</id>
    <content type="html">&lt;p&gt;With DevTools you can &lt;a href=&quot;https://devtoolstips.org/tips/en/fix-color-contrast-issues/detect-low-color-contrast.md&quot;&gt;detect low color contrast issues&lt;/a&gt; which is great. But Chrome DevTools, Edge DevTools, and Polypane, you can go one step further and fix these issues directly!&lt;/p&gt;
&lt;h2 id=&quot;in-chrome-and-edge&quot; tabindex=&quot;-1&quot;&gt;In Chrome and Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/fix-color-contrast-issues/#in-chrome-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here is a tip shared on &lt;a href=&quot;https://dev.to/domizajac/how-to-use-chrome-devtools-to-find-a-color-fixing-insufficient-color-contrast-ratio-on-your-html-element-546k&quot;&gt;dev.to&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/domizajac&quot;&gt;Domi&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Find an element which text color doesn&#39;t have enough contrast with its background color.&lt;/li&gt;
&lt;li&gt;Select this element in the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click on the little color swatch next to the color value in the &lt;strong&gt;Styles&lt;/strong&gt; pane.&lt;/li&gt;
&lt;li&gt;A color picker will appear. Expand the &lt;strong&gt;Contrast ratio&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;A couple of useful lines appear in the color gradient. These lines represent the minimum contrast ratio required for the text to be readable.&lt;/li&gt;
&lt;li&gt;You can also click on the little reload icons next to the AA and AAA labels in the &lt;strong&gt;Contrast ratio&lt;/strong&gt; section to let DevTools suggest a color that would pass the AA or AAA requirements.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/fix-color-contrast-issues-chromium.png&quot; alt=&quot;The chrome color picker, showing the contrast lines and new color suggestions&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-polypane&quot; tabindex=&quot;-1&quot;&gt;In Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/fix-color-contrast-issues/#in-polypane&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Polypane, these suggestions are made inline on the page itself when enabling the &lt;strong&gt;Contrast checker debug tool&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/fix-color-contrast-issues-polypane.png&quot; alt=&quot;A Polypane Pane with the Contrast checker debug tool active.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Debug popups that appear on hover using the debugger statement</title>
    <link href="https://devtoolstips.org/tips/en/debug-js-hover-2/"/>
    <updated>2022-03-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-js-hover-2/</id>
    <content type="html">&lt;p&gt;In &lt;a href=&quot;https://devtoolstips.org/tips/en/debug-js-hover-2/debug-js-hover.md&quot;&gt;Debug popups that appear on hover using JS&lt;/a&gt; we described how to pause the debugger to inspect popups that appear on hover and disappear as soon as the cursor moves away.&lt;/p&gt;
&lt;p&gt;Here&#39;s another way to do this by &lt;a href=&quot;https://twitter.com/mzainzafar90&quot;&gt;Zain Zafar&lt;/a&gt; which involves using the &lt;code&gt;debugger&lt;/code&gt; statement in the &lt;strong&gt;Console&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;setTimeout(() =&amp;gt; {debugger}, 3000)&lt;/code&gt; and press &lt;kbd&gt;Enter&lt;/kbd&gt;. You can change the 3 seconds delay to anything that matches your needs.&lt;/li&gt;
&lt;li&gt;Quickly hover over the popup and wait for the debugger to pause the script execution.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now the popup is visible and you can easily inspect it without having to worry about it disappearing.&lt;/p&gt;
&lt;p&gt;Zain shared this awesome tip on &lt;a href=&quot;https://twitter.com/mzainzafar90/status/1485510393409773571&quot;&gt;Twitter&lt;/a&gt; and &lt;a href=&quot;https://www.youtube.com/watch?v=jh8hUH_Zp0o&quot;&gt;YouTube&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>console.log() is great, but do you know console.table()? console.group()? console.assert()?</title>
    <link href="https://devtoolstips.org/tips/en/console-table-group-assert/"/>
    <updated>2022-03-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/console-table-group-assert/</id>
    <content type="html">&lt;p&gt;You probably know about &lt;code&gt;console.log()&lt;/code&gt; already, it&#39;s a great way to print variables and objects to the console while the code is running, to debug it. But there are other console methods that can help you debug your code even more easily (you can &lt;a href=&quot;https://devtoolstips.org/tips/en/console-table-group-assert/list-console-functions.md&quot;&gt;list them all&lt;/a&gt; by the way).&lt;/p&gt;
&lt;h2 id=&quot;console.table&quot; tabindex=&quot;-1&quot;&gt;console.table &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/console-table-group-assert/#console.table&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;console.table()&lt;/code&gt; is great to print arrays and objects in a tabular format.&lt;/p&gt;
&lt;p&gt;Say you have the following data:&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;const products = &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  id&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  name&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &#39;Instant Pot&#39;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  price&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;79.99&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  inStock&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  id&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  name&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &#39;Aeropress Coffee Maker&#39;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  price&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;29.99&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  inStock&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  id&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  name&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &#39;George Foreman Grill&#39;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  price&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;25.99&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  inStock&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can log it to the console a much more readable way with &lt;code&gt;console.table()&lt;/code&gt; by using the following code: &lt;code&gt;console.table(products);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/console-table-group-assert-1.jpg&quot; alt=&quot;The Chrome DevTools Console tool showing a table that contains each object in a separate row, and each object property in its own column&quot; /&gt;&lt;/p&gt;
&lt;p&gt;You can even &lt;a href=&quot;https://devtoolstips.org/tips/en/console-table-group-assert/customize-console-table-columns.md&quot;&gt;customize the table columns that are shown&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;console.group&quot; tabindex=&quot;-1&quot;&gt;console.group &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/console-table-group-assert/#console.group&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When your code generates a lot of logs, it can quickly become difficult to read those logs in the console.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;console.group()&lt;/code&gt; allows you to group console logs together and indent them in a nice collapsible section, making them easier to read.&lt;/p&gt;
&lt;p&gt;Take the following code example that generate a lot of logs:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; product &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; products&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;id&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;price&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;inStock&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/console-table-group-assert-2.png&quot; alt=&quot;The Chrome DevTools Console tool showing multiple log lines that are hard to quickly scan&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Now let&#39;s use &lt;code&gt;console.group()&lt;/code&gt; to group those logs together:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; product &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; products&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;ID:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;id&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;Price:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;price&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;In stock:&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;inStock&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;groupEnd&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/console-table-group-assert-3.png&quot; alt=&quot;The Chrome DevTools Console tool showing the same logs, but grouped by product&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;console.assert&quot; tabindex=&quot;-1&quot;&gt;console.assert &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/console-table-group-assert/#console.assert&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Finally, the &lt;code&gt;console.assert&lt;/code&gt; method allows you to log an error to the console only if some predefined condition is not met.&lt;/p&gt;
&lt;p&gt;Let&#39;s say you want to make sure that all products in the &lt;code&gt;products&lt;/code&gt; array are in stock and log an error if not.&lt;/p&gt;
&lt;p&gt;You could use an &lt;code&gt;if&lt;/code&gt; statement and &lt;code&gt;console.error&lt;/code&gt;, like this:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;products&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;product&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;inStock&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; is not in stock&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using &lt;code&gt;console.assert&lt;/code&gt; requires less code:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;products&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;product&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;assert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;inStock&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;product&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; is not in stock&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/console-table-group-assert-4.png&quot; alt=&quot;The Chrome DevTools Console tool showing an error message for one of the products&quot; /&gt;&lt;/p&gt;
&lt;p&gt;That&#39;s it!&lt;/p&gt;
&lt;p&gt;Credits go to &lt;a href=&quot;https://suze.dev/blog/debugging-javascript-beyond-console-log/&quot;&gt;Suze Shardlow&lt;/a&gt; for sharing this on her site.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Debug CSS grid areas</title>
    <link href="https://devtoolstips.org/tips/en/debug-grid-areas/"/>
    <updated>2022-03-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-grid-areas/</id>
    <content type="html">&lt;p&gt;A really useful way to position elements on a CSS grid is using the &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/CSS_Grid_Layout/Grid_Template_Areas&quot;&gt;&lt;code&gt;grid-template-areas&lt;/code&gt;&lt;/a&gt; property. With it, you can give names to various areas of your grid (potentially spanning multiple cells), and then simply position your elements by referring to those names.&lt;/p&gt;
&lt;p&gt;The syntax for the &lt;code&gt;grid-template-areas&lt;/code&gt; property is a bit special though. It consists in a series of strings where each corresponds to one row in the grid. For example:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.container&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;grid-template-areas&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;header  header&quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span class=&quot;token string&quot;&gt;&quot;sidebar main  &quot;&lt;/span&gt;&lt;br /&gt;                       &lt;span class=&quot;token string&quot;&gt;&quot;sidebar footer&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;DevTools makes it very easy to debug potential problems that may occur when making mistakes with the above syntax:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Elements&lt;/strong&gt; tool (or &lt;strong&gt;Inspector&lt;/strong&gt; tool in Firefox).&lt;/li&gt;
&lt;li&gt;Select an element from the page that defines a grid container with named areas (you can use the &lt;strong&gt;grid&lt;/strong&gt; badge in the DOM tree to find grid containers).&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Layout&lt;/strong&gt; sidebar pane.&lt;/li&gt;
&lt;li&gt;Under the &lt;strong&gt;Grid&lt;/strong&gt; section, enable the &lt;strong&gt;Show area names&lt;/strong&gt; checkbox (named &lt;strong&gt;Area Names&lt;/strong&gt; in Safari).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-grid-areas.png&quot; alt=&quot;Firefox showing a highlighted grid in the page showing the area names, and DevTools below it with the &amp;quot;display area names&amp;quot; option checked.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Emulate forced-color mode</title>
    <link href="https://devtoolstips.org/tips/en/emulate-forced-colors/"/>
    <updated>2022-03-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/emulate-forced-colors/</id>
    <content type="html">&lt;p&gt;Operating systems offer an accessibility feature where the colors shown on the screen are converted to offer higher contrast. When you use this feature, it impacts all the content on the screen: your desktop, folders, native apps, web browser and its web content, etc.&lt;/p&gt;
&lt;p&gt;This means web pages are not displayed in their usual colors, but in a high-contrast mode instead. Learn more about the Windows high-contrast mode and how to style a website with it &lt;a href=&quot;https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/&quot;&gt;here&lt;/a&gt; and about the &lt;code&gt;forced-colors&lt;/code&gt; media query &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/@media/forced-colors&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you are not using this high-contrast mode yourself though, you won&#39;t know how your website looks to users who do. To make sure your content is fully accessible to users of this mode, and to avoid having to switch your entire OS to it, you can use Edge&#39;s or Chrome&#39;s ability to emulate the forced-color mode.&lt;/p&gt;
&lt;p&gt;In Edge or Chrome:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;a href=&quot;https://devtoolstips.org/tips/en/emulate-forced-colors/execute-commands.md&quot;&gt;Command Menu&lt;/a&gt;: &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; (or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; on mac).&lt;/li&gt;
&lt;li&gt;Type &lt;strong&gt;Rendering&lt;/strong&gt; and press &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Rendering&lt;/strong&gt; panel, scroll down to the &lt;strong&gt;Emulate CSS media feature forced-colors&lt;/strong&gt; and activate it from the drop-down.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-forced-colors.png&quot; alt=&quot;Edge showing a webpage in forced-colors mode, with the Rendering panel next to it in DevTools.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Emulation options&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Toggle &lt;strong&gt;Forced colors&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;(Optionally) Toggle the &lt;code&gt;prefers-color-scheme&lt;/code&gt; to test both a light and dark forced color mode.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/emulate-forced-colors-polypane.png&quot; alt=&quot;Polypane showing a webpage in forced-colors mode, with the Emulation options opened above it, the &amp;quot;forced colors&amp;quot; option is active and highlighted.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Check if your site can be instantly reloaded from bfcache</title>
    <link href="https://devtoolstips.org/tips/en/check-bfcache-readiness/"/>
    <updated>2022-03-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/check-bfcache-readiness/</id>
    <content type="html">&lt;p&gt;Most browsers are now able to instantly go back to previously visited pages without having to wait for them to load. This ability is powered by the back/forward cache (or bfcache). Firefox, Safari, and Chromium-based browsers support it, and it&#39;s massive performance boost when hitting the back button.&lt;/p&gt;
&lt;p&gt;The way the bfcache works is by storing a snapshot of the page in memory, in a way that no work needs to be done when going back to it, other than displaying the pixels on the screen.&lt;/p&gt;
&lt;p&gt;Not all web pages can be cached in bfcache though. Chrome and Edge have a new tool that lets you detect potential issues with a page that might prevent it from being bfcache&#39;d.&lt;/p&gt;
&lt;p&gt;To test if your page can be cached:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Application&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Back/forward cache&lt;/strong&gt; in the side bar.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Test back/forward cache&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A report will be displayed, telling you whether your page can be cached, and if not, why.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/check-bfcache-readiness.png&quot; alt=&quot;Chrome DevTools with the Application tool, and the bfcache tab selected, showing a warning that the page can&#39;t be cached.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Send feedback, ask for features and report bugs</title>
    <link href="https://devtoolstips.org/tips/en/send-feedback-about-devtools/"/>
    <updated>2022-03-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/send-feedback-about-devtools/</id>
    <content type="html">&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/send-feedback-about-devtools.png&quot; alt=&quot;A feedback illustration showing a stick figure with a speech bubble&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Browser vendors depend on your feedback to build the right tools for you. Without hearing from you all about what problems you have, or what features you lack, they can&#39;t take the right decisions about what to build.&lt;/p&gt;
&lt;p&gt;If you report bugs to the DevTools team when you see them, you won&#39;t just be helping you when the fix comes, but you may be helping many others who have the same bug but haven&#39;t reported it.&lt;/p&gt;
&lt;p&gt;It&#39;s worth knowing that the various DevTools teams at Microsoft, Mozilla, Apple and Google are usually fairly small and receive a lot of feedback, so reporting an issue does not mean it will be fixed quickly (or at all, if it&#39;s lower priority than others), but it does help, and those teams &lt;strong&gt;are listening&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Here are a few ways you can report bugs, ask questions or request features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Firefox DevTools&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Firefox uses &lt;a href=&quot;https://bugzilla.mozilla.org/&quot;&gt;Bugzilla&lt;/a&gt; as their public bug tracker and anyone is welcome to report bugs or ask for new features by creating a new entry on Bugzilla. All you need is a GitHub account to log in.&lt;/li&gt;
&lt;li&gt;Getting in touch with the team can either be done on Twitter by mentioning the &lt;a href=&quot;https://twitter.com/FirefoxDevTools&quot;&gt;@FirefoxDevTools&lt;/a&gt; account, or logging in to &lt;a href=&quot;https://chat.mozilla.org/&quot;&gt;the Mozilla chat&lt;/a&gt; (find documentation about the chat &lt;a href=&quot;https://wiki.mozilla.org/Matrix&quot;&gt;here&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Safari Web Inspector&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Like Firefox, Safari uses the Bugzilla product to track their &lt;a href=&quot;https://bugs.webkit.org/&quot;&gt;webkit bugs&lt;/a&gt;. Here is documentation about how to &lt;a href=&quot;https://webkit.org/reporting-bugs/&quot;&gt;search for bugs and report new ones&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You can also get in touch with the team on Twitter with &lt;a href=&quot;https://twitter.com/webkit&quot;&gt;@webkit&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Finally, you can also signal bugs about Safari and the Safari Web Inspector using the &lt;a href=&quot;https://developer.apple.com/bug-reporting/&quot;&gt;feedback assistant&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chromium&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Chromium is an open-source project that several browsers are based on, including Google Chrome and Microsoft Edge. If you believe you found a bug that pertains to Chromium rather than just one of the browsers based on it, you can head over to the Monorail bug tracker that Chromium uses and &lt;a href=&quot;https://bugs.chromium.org/p/chromium/issues/list&quot;&gt;find all issues and create new ones here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Edge DevTools&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;The easiest way to report a problem you encountered while using the tools is by using &lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/contact#use-the-send-feedback-window&quot;&gt;the feedback button&lt;/a&gt; in DevTools (the little stick figure in the top-right corner of the tools).&lt;/li&gt;
&lt;li&gt;But if you have ideas, questions, feedback, and want to have longer conversations, use the &lt;a href=&quot;https://github.com/MicrosoftEdge/DevTools/&quot;&gt;Edge DevTools feedback repository&lt;/a&gt; instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chrome DevTools&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;On top of the Chromium bug tracker, the team also listens for feedback on &lt;a href=&quot;https://www.chromium.org/teams/devtools&quot;&gt;the devtools-dev mailing list&lt;/a&gt; as well as on twitter at &lt;a href=&quot;https://twitter.com/ChromeDevTools&quot;&gt;@ChromeDevTools&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Polypane&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;In the Help menu select &amp;quot;Chat with us&amp;quot; to chat with Polypane directly, or click &amp;quot;Get Support&amp;quot; to email them. On top of chat and email, the team also listens for feedback on twitter at &lt;a href=&quot;https://twitter.com/Polypane&quot;&gt;@polypane&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Manipulate complex JSON files using DevTools</title>
    <link href="https://devtoolstips.org/tips/en/manipulate-complex-json/"/>
    <updated>2022-03-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/manipulate-complex-json/</id>
    <content type="html">&lt;p&gt;I often work with large amount of data that I need to go through and gather interesting information from. Sometimes this data is in JSON format. When that&#39;s the case, I like using DevTools to turn it into what I want, using JavaScript!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I copy the JSON data content from a text editor.&lt;/li&gt;
&lt;li&gt;I open the &lt;strong&gt;Snippet&lt;/strong&gt; pane in the &lt;strong&gt;Sources&lt;/strong&gt; tool (&lt;a href=&quot;https://devtoolstips.org/tips/en/manipulate-complex-json/use-scripts-as-snippets.md&quot;&gt;learn more about snippets&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;I paste the data in a new snippet, work on it with JavaScript to extract what I need (usually using array functions like &lt;code&gt;map&lt;/code&gt; and &lt;code&gt;filter&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Finally I extract the data again using the &lt;code&gt;copy&lt;/code&gt; function, and paste it back into my text editor (&lt;a href=&quot;https://devtoolstips.org/tips/en/manipulate-complex-json/copy-from-console.md&quot;&gt;learn more about copy&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take a look at the following video to see my workflow in action:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=W8s9UiEhaLE&quot;&gt;https://www.youtube.com/watch?v=W8s9UiEhaLE&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that while the workflow works in every browser, the &lt;strong&gt;Snippets&lt;/strong&gt; pane only exists in Edge and Chrome. In Firefox, you can use the &lt;a href=&quot;https://devtoolstips.org/tips/en/manipulate-complex-json/multi-line-console.md&quot;&gt;multi-line console&lt;/a&gt; to do the same thing.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/manipulate-complex-json.png&quot; alt=&quot;VSCode with some JSON data and DevTools next to it with the snippets panel containing JS code to manipulate the JSON.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Detect low color contrast issues</title>
    <link href="https://devtoolstips.org/tips/en/detect-low-color-contrast/"/>
    <updated>2022-03-03T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/detect-low-color-contrast/</id>
    <content type="html">&lt;p&gt;Low color vision is very common, and your choice of text and background colors can negatively impact people&#39;s experience of your website. What seems legible to you might not be for everyone.&lt;/p&gt;
&lt;p&gt;DevTools comes with a number of features to help you detect possible color contrast issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can simulate various color vision deficiencies ➡️ &lt;a href=&quot;https://devtoolstips.org/tips/en/detect-low-color-contrast/simulate-color-vision-deficiencies.md&quot;&gt;Simulate color vision deficiencies&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can get color contrast ratios on hover, when using the inspect tool ➡️ &lt;a href=&quot;https://devtoolstips.org/tips/en/detect-low-color-contrast/see-quick-a11y-info-on-hover.md&quot;&gt;See quick accessibility information on hover&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Chrome and Edge, you can list all contrast issues at once with the &lt;strong&gt;CSS Overview&lt;/strong&gt; tool.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;a href=&quot;https://devtoolstips.org/tips/en/detect-low-color-contrast/execute-commands.md&quot;&gt;Command Menu&lt;/a&gt;: &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; (or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; on mac).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Capture overview&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Colors&lt;/strong&gt; tab in the sidebar and scroll down to the &lt;strong&gt;Contrast issues&lt;/strong&gt; section.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/detect-low-color-contrast-css-overview.png&quot; alt=&quot;The CSS Overview panel in Chrome, showing the color contrast issues section.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Firefox, you can find all contrast issues too, using the &lt;strong&gt;Accessibility&lt;/strong&gt; panel.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Accessibility&lt;/strong&gt; panel from the toolbar.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Check for issues&lt;/strong&gt; drop-down, select &lt;strong&gt;Contrast&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click each item in the table and review the color contrast ratio.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/detect-low-color-contrast-accessibility-panel.png&quot; alt=&quot;The Accessibility panel in Firefox, showing the list of contrast issues.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Polypane, you can find all contrast issues with the &lt;strong&gt;Color Contrast debug tool&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Debug Tools&lt;/strong&gt; settings of a pane.&lt;/li&gt;
&lt;li&gt;Find &lt;strong&gt;Contrast Checker&lt;/strong&gt; Under &lt;strong&gt;Accessibility&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select whether you want to check for WCAG &lt;strong&gt;AA&lt;/strong&gt; or &lt;strong&gt;AAA&lt;/strong&gt; compliance.&lt;/li&gt;
&lt;li&gt;Contrast issues are displayed inline on the page. Where available, Polypane suggests improved colors.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/detect-low-color-contrast-inline.png&quot; alt=&quot;A Polypane Pane with the Contrast checker debug tool active.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Paste multiple CSS declarations at once</title>
    <link href="https://devtoolstips.org/tips/en/past-several-css-declarations/"/>
    <updated>2022-02-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/past-several-css-declarations/</id>
    <content type="html">&lt;p&gt;You know how you can paste a CSS property name or value in the &lt;strong&gt;Styles&lt;/strong&gt; (or &lt;strong&gt;Rules&lt;/strong&gt;) panel? Well, you can actually paste several declarations at once too!&lt;/p&gt;
&lt;p&gt;For example, try copying the following entire CSS code snippet, which includes multiple declarations:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; courier&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 14pt&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #f06&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 4rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now open DevTools, and the &lt;strong&gt;Elements&lt;/strong&gt; (or &lt;strong&gt;Inspector&lt;/strong&gt;) panel, find a CSS rule and click somewhere in it as if you were about to type a new property.&lt;/p&gt;
&lt;p&gt;And now paste the code in. Instead of everything getting pasted in just this one text field, see how DevTools noticed that your clipboard contained multiple declarations, and created them all for you!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/paste-several-css-declarations.gif&quot; alt=&quot;Animation showing how pasting several declarations in a CSS rule in DevTools creates them all.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Detect the element with focus at any time</title>
    <link href="https://devtoolstips.org/tips/en/track-focused-element/"/>
    <updated>2022-02-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/track-focused-element/</id>
    <content type="html">&lt;p&gt;If you want to know which element has the focus on the web page at any time, you can use a &lt;a href=&quot;https://devtoolstips.org/tips/en/track-focused-element/live-expressions.md&quot;&gt;live expression&lt;/a&gt; in the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Console&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Create live expression&lt;/strong&gt; button (it looks like an eye icon).&lt;/li&gt;
&lt;li&gt;In the text box that appears, type &lt;code&gt;document.activeElement&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Now click/tab around on the page and see the live expression update to reflect which element is currently focused.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/track-focused-element.gif&quot; alt=&quot;Animation showing a web page with focus going through different element, and the Edge Console panel with the live expression showing a preview of the focused element.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Use full browser window for device emulation</title>
    <link href="https://devtoolstips.org/tips/en/use-full-browser-for-device-emulation/"/>
    <updated>2022-02-09T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/use-full-browser-for-device-emulation/</id>
    <content type="html">&lt;p&gt;Emulating different devices in the browser is incredibly useful. It gets tricky when you are on a device with limited resolution as the emulated device needs to be zoomed down to fit the screen as a large part of the window is taken up by the Developer Tools.&lt;/p&gt;
&lt;p&gt;In Polypane, responsive design mode with multiple devices is the default.&lt;/p&gt;
&lt;p&gt;Firefox has a keyboard shortcut to show device emulation without Developer Tools - &lt;kbd&gt;command&lt;/kbd&gt; + &lt;kbd&gt;option&lt;/kbd&gt; + &lt;kbd&gt;M&lt;/kbd&gt; on Mac and &lt;kbd&gt;ctrl&lt;/kbd&gt; + &lt;kbd&gt;shift&lt;/kbd&gt; + &lt;kbd&gt;M&lt;/kbd&gt; on Windows/Linux.&lt;/p&gt;
&lt;p&gt;On Chromium based browsers like Chrome and Edge the trick is to start the device emulation and then un-dock the Developer Tools. You can un-dock the tools into their own window using the &lt;code&gt;…&lt;/code&gt; menu. This gives you the full browser as an emulation playground.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/use-full-browser-for-device-emulation.gif&quot; alt=&quot;Animation showing device emulation and how to undock the Developer Tools into an own window.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Record and replay user flows</title>
    <link href="https://devtoolstips.org/tips/en/record-replay/"/>
    <updated>2022-02-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/record-replay/</id>
    <content type="html">&lt;p&gt;Sometimes, you need to repeatedly test the same user scenario on a website. This can happen when working on a fix or a performance improvement. Testing the same user scenario over and over again requires clicking the same buttons and do the same actions every time you reload the page. This can quickly become time consuming and frustrating.&lt;/p&gt;
&lt;p&gt;To automate this process, you can use the &lt;strong&gt;Recorder&lt;/strong&gt; tool in Chrome or Edge. The &lt;strong&gt;Recorder&lt;/strong&gt; tool allows you to record any user flow once, and then replay the flow as many times as you want.&lt;/p&gt;
&lt;p&gt;To record a new flow:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Recorder&lt;/strong&gt; tool:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Chrome, the &lt;strong&gt;Recorder&lt;/strong&gt; tab is already available in the main toolbar. If you don&#39;t see it, click &lt;strong&gt;More tabs&lt;/strong&gt; (&lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt;) &amp;gt; &lt;strong&gt;Recorder&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In Edge, click &lt;strong&gt;More tools&lt;/strong&gt; (&lt;code&gt;+&lt;/code&gt;) in the Activity Bar, then &lt;strong&gt;Recorder&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Create a new recording&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a name for your recording.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Start recording&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the page as normal, for example click on buttons, use form controls, navigate to other pages.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When you&#39;re done with the user flow you want to record, click &lt;strong&gt;End recording&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your recording is now available in the &lt;strong&gt;Recorder&lt;/strong&gt; tool. To replay your recording, click &lt;strong&gt;Replay&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you close and then reopen DevTools, your recording will still be available in the &lt;strong&gt;Recorder&lt;/strong&gt; tool. To replay it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find your recording in the tool&#39;s initial screen, or from the dropdown located in the tool&#39;s toolbar.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Replay&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/record-replay.png&quot; alt=&quot;Animation of the Recorder panel automatically replaying a set of recorded steps.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To learn more about the &lt;strong&gt;Recorder&lt;/strong&gt; tool (including how to edit a recording and how to use it to test performance improvements), see &lt;a href=&quot;https://developer.chrome.com/docs/devtools/recorder/&quot;&gt;Record, replay, and measure user flows&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Remove or disable event listeners</title>
    <link href="https://devtoolstips.org/tips/en/disable-event-listeners/"/>
    <updated>2022-01-26T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/disable-event-listeners/</id>
    <content type="html">&lt;p&gt;When you&#39;re trying to debug something and event listeners on the page keep interfering with what you&#39;re doing, it can be frustrating.&lt;br /&gt;
Imagine a &lt;code&gt;mousemove&lt;/code&gt; event listener that changes some of the information on the page.&lt;/p&gt;
&lt;p&gt;Fortunately, DevTools can help you here.&lt;/p&gt;
&lt;p&gt;In Firefox, you can disable (and re-enable) events from the &lt;strong&gt;Inspector&lt;/strong&gt; panel:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find the element in the panel that has the event listener.&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;event&lt;/code&gt; badge next to it.&lt;/li&gt;
&lt;li&gt;Find the event type you are interested in.&lt;/li&gt;
&lt;li&gt;Check or uncheck the box next to the event listener to enable or disable it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/disable-event-listeners-firefox.png&quot; alt=&quot;The Firefox event popup in the Inspector panel, showing the checkbox to toggle events.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In Chrome and Edge, you can remove events from the &lt;strong&gt;Elements&lt;/strong&gt; panel (but not add them again):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find the element in the panel that has the event listener.&lt;/li&gt;
&lt;li&gt;In the sidebar of the panel, find the &lt;strong&gt;Event Listeners&lt;/strong&gt; pane.&lt;/li&gt;
&lt;li&gt;Find the event type you are interested in and expand it.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Remove&lt;/strong&gt; button next to the listener you want to remove.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/disable-event-listeners-chrome.png&quot; alt=&quot;The Chrome Event Listeners sidebar pane, showing the Remove button.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find HTML parsing errors</title>
    <link href="https://devtoolstips.org/tips/en/find-html-parsing-errors/"/>
    <updated>2022-01-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-html-parsing-errors/</id>
    <content type="html">&lt;p&gt;DevTools is so full of features these days that we hardly ever use View-Source anymore. But it turns out that it has one trick up its sleeves that other tools don&#39;t, at least in Firefox and Polypane.&lt;/p&gt;
&lt;p&gt;Indeed, in those browsers, on top of showing the HTML source code of the page, it also highlights in red the HTML parsing errors!&lt;/p&gt;
&lt;p&gt;Consider the following HTML code:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token doctype&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt; &lt;span class=&quot;token name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    Lorem ipsum dolor sit...&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    Lorem ipsum dolor sit...&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    Lorem ipsum dolor sit&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;em&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;, ...&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;ul&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Firefox&#39;s view-source makes it easy to find the stray &lt;code&gt;&amp;lt;/em&amp;gt;&lt;/code&gt; ending tag! You can also hover over it to reveal more information about the type of parsing error.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-html-parsing-errors.png&quot; alt=&quot;The View-Source page in Firefox, with a stray em closing tag highlighted in red, with a tooltip.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Polypane additionally shows all validation errors in a list above the source.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Select elements with pointer-events:none by holding Shift</title>
    <link href="https://devtoolstips.org/tips/en/select-pointer-events-none-elements/"/>
    <updated>2022-01-13T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/select-pointer-events-none-elements/</id>
    <content type="html">&lt;p&gt;When selecting elements from the page they normally get highlighted on hover and selected on click. However certain elements can&#39;t be selected.&lt;/p&gt;
&lt;p&gt;Indeed, if an element does not react to pointer events because the &lt;code&gt;pointer-events:none&lt;/code&gt; CSS declaration is set, then you just can&#39;t select it, and the only way to get to it is to find it in the &lt;strong&gt;Elements&lt;/strong&gt;/&lt;strong&gt;Inspector&lt;/strong&gt; panel.&lt;/p&gt;
&lt;p&gt;In Chrome, Edge, Polypane and Firefox, you can hold the &lt;kbd&gt;Shift&lt;/kbd&gt; key on your keyboard while hovering elements in the page! When you do this, even elements with &lt;code&gt;pointer-events:none&lt;/code&gt; can be selected!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/select-pointer-events-none-elements.gif&quot; alt=&quot;Animation showing how a pointer-events:none element normally can&#39;t be selected, except when Shift is pressed.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/simevidas/status/1464501900586463236&quot;&gt;Šime Vidas&lt;/a&gt; also proposed this alternative solution in Firefox:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Accessibility&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Use the accessibility picker tool (top-left corner) to pick the element from the page.&lt;/li&gt;
&lt;li&gt;Find the corresponding DOM node in the &lt;strong&gt;Properties&lt;/strong&gt; sidebar panel, and click the inspect icon next to it.&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  
  <entry>
    <title>Query object instances and holders from the console</title>
    <link href="https://devtoolstips.org/tips/en/query-instances-holders/"/>
    <updated>2022-01-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/query-instances-holders/</id>
    <content type="html">&lt;p&gt;All browser DevTools have a few built-in functions in the console to do things like &lt;a href=&quot;https://devtoolstips.org/tips/en/query-instances-holders/get-current-element-in-console.md&quot;&gt;get the current element&lt;/a&gt;, or &lt;a href=&quot;https://devtoolstips.org/tips/en/query-instances-holders/copy-from-console.md&quot;&gt;copy a string&lt;/a&gt;. But Safari exposes 2 nice built-in functions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;queryInstances&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;queryHolders&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These two functions are really useful when your site starts using a lot of JavaScript objects. In some situations, it may become difficult to keep track of the dependencies between these objects, and memory leaks may start to appear, too.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;app.TodoItem&lt;/code&gt; is a JavaScript class in your application, then &lt;code&gt;queryInstances(app.TodoItem)&lt;/code&gt; will return an array of all of its instances.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/query-instances-holders-1.png&quot; alt=&quot;The console in Safari, showing the result of queryInstances(app.TodoItem).&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Or if you want to know what refers to the object you&#39;re debugging, use &lt;code&gt;queryHolders(this)&lt;/code&gt;, which will return an array of all the other objects that have references to &lt;code&gt;this&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/query-instances-holders-2.png&quot; alt=&quot;The console in Safari, showing the result of queryHolders(this).&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Learn more about these, and other, built-in functions &lt;a href=&quot;https://webkit.org/web-inspector/console-command-line-api/#functions&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Get detached DOM elements to investigate memory leaks</title>
    <link href="https://devtoolstips.org/tips/en/get-detached-elements/"/>
    <updated>2022-01-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/get-detached-elements/</id>
    <content type="html">&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This Microsoft Edge-specific feature is being removed starting with Edge 133. The feature that it provides will continue to be available by using the &lt;strong&gt;Memory&lt;/strong&gt; tool instead, and using the upcoming &lt;strong&gt;Detached Elements&lt;/strong&gt; profiling type. The new profiling type will be available in all Chromium-browsers.&lt;/p&gt;
&lt;p&gt;Memory leaks can quickly become a big problem for long-running applications, and a common source of memory leaks is detached DOM elements (elements that are no longer attached to the DOM tree).&lt;br /&gt;
It&#39;s usually very hard to investigate these memory leaks, because it&#39;s hard to know if elements are detached, and which ones, let alone find which part of your JavaScript code is causing them to be detached.&lt;/p&gt;
&lt;p&gt;Edge has a tool just for this: the &lt;strong&gt;Detached Elements&lt;/strong&gt; panel. To use it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;command menu&lt;/strong&gt; and type &amp;quot;detached&amp;quot; to find and open the &lt;strong&gt;Detached Elements&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Get detached elements&lt;/strong&gt; button to list all of the currently detached elements.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Analyze&lt;/strong&gt; button to take a memory heap snapshot. Once done, you can then double-click any of the detached elements&#39; &lt;strong&gt;Id&lt;/strong&gt;s to find the link between these elements and your JavaScript code in the &lt;strong&gt;Memory&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Don&#39;t forget to click the &lt;strong&gt;Collect garbage&lt;/strong&gt; button every once in a while to force garbage collection. Then get the detached elements again. Indeed, some elements may remain in memory simply because the browser hasn&#39;t yet cleaned them up. Forcing GC makes sure the list only contains the elements that are detached and cannot be cleaned up.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can find out much more about this tool in this &lt;a href=&quot;https://blogs.windows.com/msedgedev/2021/12/09/debug-memory-leaks-detached-elements-tool-devtools/&quot;&gt;blog post&lt;/a&gt; and over at Microsoft&#39;s &lt;a href=&quot;https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/memory-problems/dom-leaks&quot;&gt;documentation&lt;/a&gt; site.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/get-detached-elements.png&quot; alt=&quot;The Detached Elements panel in Edge, with the Memory panel next to it.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Write code on multiple lines in the Console</title>
    <link href="https://devtoolstips.org/tips/en/multi-line-console/"/>
    <updated>2021-12-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/multi-line-console/</id>
    <content type="html">&lt;p&gt;If you&#39;re feeling adventurous and want to write longer pieces of code in the &lt;strong&gt;Console&lt;/strong&gt; to execute more complex things, it can quickly become difficult.&lt;/p&gt;
&lt;p&gt;Thankfully, there are a few ways to make your life easier by writing on multiple lines, like you would in a code editor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt; to create a new line without executing the expression. This works in all browsers.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Or use Firefox&#39;s multiline editor. To do this, click on the &lt;strong&gt;Switch to multi-line editor mode&lt;/strong&gt; button located in the top-right corner of the &lt;strong&gt;Console&lt;/strong&gt; message area (or press &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;B&lt;/kbd&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/multi-line-console-firefox.png&quot; alt=&quot;Tthe button to switch the Firefox console to the multi-line mode.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Or you can create code snippets in Edge, Chrome, or Safari&#39;s &lt;strong&gt;Sources&lt;/strong&gt; tools. The added advantage of this technique is that code snippets are saved on your disk, and therefore can be used even after you&#39;ve restarted the browser. See &lt;a href=&quot;https://devtoolstips.org/tips/en/multi-line-console/use-scripts-as-snippets.md&quot;&gt;Re-use scripts as snippets&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/multi-line-console-snippet.png&quot; alt=&quot;The snippet tab in Edge&#39;s Sources panel.&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Download all images from the page</title>
    <link href="https://devtoolstips.org/tips/en/download-all-images/"/>
    <updated>2021-12-16T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/download-all-images/</id>
    <content type="html">&lt;p&gt;If you want to download all of the images on a webpage in one go, you can use the following few lines of JavaScript code to do it:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token function&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;img&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; src &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; img&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;src&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Fetch the image as a blob.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; fetchResponse &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;src&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; blob &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; fetchResponse&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;blob&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; mimeType &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; blob&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;type&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Figure out a name for it from the src and the mime-type.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; start &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; src&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;lastIndexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; end &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; src&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; name &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; src&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;substring&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; end &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;undefined&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; end&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    name &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; name&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;[^a-zA-Z0-9]+&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-flags&quot;&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;-&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    name &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; mimeType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;substring&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mimeType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;lastIndexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;/&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Download the blob using a &amp;lt;a&gt; element.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; a &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;a&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    a&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;href&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createObjectURL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;blob&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    a&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;download&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; name&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    a&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will list all of the &lt;code&gt;img&lt;/code&gt; elements on the page, then attempt to fetch them from the server (which might fail for some, depending on the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP&quot;&gt;CSP&lt;/a&gt; on the page), and then trigger the download of each one of them by the browser, using a &lt;code&gt;&amp;lt;a download&amp;gt;&lt;/code&gt; element.&lt;/p&gt;
&lt;p&gt;If you want to reuse this script often, you can store it in your &lt;strong&gt;Snippets&lt;/strong&gt; on Chrome or Edge (learn how to do it &lt;a href=&quot;https://devtoolstips.org/tips/en/download-all-images/multi-line-console.md&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/download-all-images.png&quot; alt=&quot;The Snippets panel in Edge, with the JS code from above, and the download panel open showing all images have been downloaded&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit and resend faulty network requests to debug them</title>
    <link href="https://devtoolstips.org/tips/en/edit-and-resend-network-requests/"/>
    <updated>2021-12-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-and-resend-network-requests/</id>
    <content type="html">&lt;p&gt;When you&#39;re investigating a bug where the backend you connect to doesn&#39;t respond with the right things it&#39;s useful to tweak the requests and try again quickly. You can do this by changing your frontend code, and reloading the page, but DevTools can help you go faster by letting you edit and then resend any request, without having to make any frontend code changes.&lt;/p&gt;
&lt;p&gt;Below are a few ways to do this, depending on your browser of choice.&lt;/p&gt;
&lt;h2 id=&quot;using-curl-(firefox%2C-chrome%2C-edge)&quot; tabindex=&quot;-1&quot;&gt;Using cURL (Firefox, Chrome, Edge) &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/edit-and-resend-network-requests/#using-curl-(firefox%2C-chrome%2C-edge)&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Firefox, Chrome, or Edge, you can copy any request from the &lt;strong&gt;Network&lt;/strong&gt; tool as a &lt;code&gt;cURL&lt;/code&gt; command. Once copied, you can paste the command in your terminal app, edit it to match your needs, and then run it.&lt;/p&gt;
&lt;p&gt;To copy a request as &lt;code&gt;cURL&lt;/code&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Find the request you want to edit in the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Right-click the request and select &lt;strong&gt;Copy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copy as cURL&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Paste the command in your terminal app, make any changes you need, and then run it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-and-resend-network-requests-curl.png&quot; alt=&quot;Chrome DevTools&#39; Copy as cURL feature and the corresponding command in the terminal&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;using-fetch-(firefox%2C-chrome%2C-edge)&quot; tabindex=&quot;-1&quot;&gt;Using fetch (Firefox, Chrome, Edge) &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/edit-and-resend-network-requests/#using-fetch-(firefox%2C-chrome%2C-edge)&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Similar to above, you can also to use the &lt;strong&gt;Copy as Fetch&lt;/strong&gt; option in Firefox, Chrome, or Edege DevTools.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Find the request you want to edit in the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Right-click the request and select &lt;strong&gt;Copy&lt;/strong&gt; &amp;gt; &lt;strong&gt;Copy as Fetch&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Paste the copied code in the &lt;strong&gt;Console&lt;/strong&gt; tool, make any changes you need, and then run it.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;using-firefox&#39;s-edit-and-resend-feature&quot; tabindex=&quot;-1&quot;&gt;Using Firefox&#39;s Edit and Resend feature &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/edit-and-resend-network-requests/#using-firefox&#39;s-edit-and-resend-feature&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firefox has a built-in &lt;strong&gt;Edit and Resend&lt;/strong&gt; feature that&#39;s very convenient because it doesn&#39;t require to switch to the terminal or to the &lt;strong&gt;Console&lt;/strong&gt; tool. With &lt;strong&gt;Edit and Resend&lt;/strong&gt;, you stay in the &lt;strong&gt;Network&lt;/strong&gt; tool and can edit requests directly:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Find the request you want to test in the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Right-click the request and select &lt;strong&gt;Edit and Resend&lt;/strong&gt;. The &lt;strong&gt;New Request&lt;/strong&gt; sidebar appears.&lt;/li&gt;
&lt;li&gt;In the sidebar, edit the request&#39;s method, url, query string, headers, and body to match your needs&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Send&lt;/strong&gt; to resend the modified request.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-and-resend-network-requests-firefox.png&quot; alt=&quot;The Firefox&#39;s edit and resend feature.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;using-edge&#39;s-network-console-tool&quot; tabindex=&quot;-1&quot;&gt;Using Edge&#39;s Network Console tool &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/edit-and-resend-network-requests/#using-edge&#39;s-network-console-tool&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Edge has a built-in feature very similar to Firefox&#39;s &lt;strong&gt;Edit and Resend&lt;/strong&gt; named &lt;strong&gt;Network Console&lt;/strong&gt;. This feature lets you edit and resend requests, but also allows you to create any number of requests to test, like &lt;a href=&quot;https://www.postman.com/&quot;&gt;Postman&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The easiest way to get started is by going to the &lt;strong&gt;Network&lt;/strong&gt; tool and finding the request you want to test.&lt;/li&gt;
&lt;li&gt;Right-click the request and select &lt;strong&gt;Edit and Resend&lt;/strong&gt;. The &lt;strong&gt;Network Console&lt;/strong&gt; tool appears.&lt;/li&gt;
&lt;li&gt;Edit the method, url, query string, headers, body, and more to match your needs.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Send&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To test the same modified request in the future, save this request. You can find all saved requests in the &lt;strong&gt;Network Console&lt;/strong&gt; tool.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-and-resend-network-requests-edge.png&quot; alt=&quot;The Edge&#39;s Network Console feature.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Highlight the effect of individual CSS properties on hover</title>
    <link href="https://devtoolstips.org/tips/en/highlight-css-properties-on-hover/"/>
    <updated>2021-12-09T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/highlight-css-properties-on-hover/</id>
    <content type="html">&lt;p&gt;How do certain CSS properties apply to the page isn&#39;t always an easy question to answer.&lt;/p&gt;
&lt;p&gt;While some properties might be considered simple, others have complex effects that depend on other factors. Properties like &lt;code&gt;justify-content&lt;/code&gt; or &lt;code&gt;gap&lt;/code&gt; depend on writing and layout direction for example.&lt;/p&gt;
&lt;p&gt;Edge and Chrome help with this by highlighting the effect that individual CSS properties have in the page. This doesn&#39;t work with all properties, but does work with &lt;code&gt;margin&lt;/code&gt;, &lt;code&gt;padding&lt;/code&gt;, &lt;code&gt;border&lt;/code&gt;, &lt;code&gt;justify-content&lt;/code&gt;, &lt;code&gt;align-items&lt;/code&gt;, &lt;code&gt;gap&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find one of the above properties in the &lt;strong&gt;Styles&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Move your mouse cursor over it.&lt;/li&gt;
&lt;li&gt;Watch as the corresponding affected region of the element gets highlighted in the page.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/highlight-css-properties-on-hover.gif&quot; alt=&quot;Animation showing a flex layout in the page, and the cursor moving over various properties in the Styles pane.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Visualize the effect of CSS transforms</title>
    <link href="https://devtoolstips.org/tips/en/visualize-css-transforms/"/>
    <updated>2021-12-06T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/visualize-css-transforms/</id>
    <content type="html">&lt;p&gt;CSS transforms can sometimes be hard to wrap your head around, especially when chaining multiple transformations.&lt;/p&gt;
&lt;p&gt;Firefox helps with a cool visualization tool that allows you to see how and where the element was before being transformed, &lt;strong&gt;and&lt;/strong&gt; how it is now.&lt;/p&gt;
&lt;p&gt;Being able to compare the 2 states at the same time makes it easier to debug your &lt;code&gt;transform&lt;/code&gt; CSS properties.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select the transformed element in the &lt;strong&gt;Inspector&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Find the &lt;code&gt;transform&lt;/code&gt; property in the &lt;strong&gt;Rules&lt;/strong&gt; sidebar panel.&lt;/li&gt;
&lt;li&gt;Hover over the property value.&lt;/li&gt;
&lt;li&gt;The on-page highlighter appears.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/visualize-css-transforms.gif&quot; alt=&quot;Animation showing how the CSS transform highlighter appears on the page when hovering over a transform CSS property in the Rules panel.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Visualize_transforms&quot;&gt;Learn more about it here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Copy a CSS rule as CSS-in-JS format</title>
    <link href="https://devtoolstips.org/tips/en/copy-rule-as-css-in-js/"/>
    <updated>2021-11-30T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/copy-rule-as-css-in-js/</id>
    <content type="html">&lt;p&gt;Do you use a CSS-in-JS framework? If so, you know how frustrating it can be to copy CSS from DevTools and paste it into your code.&lt;/p&gt;
&lt;p&gt;Indeed if the CSS you worked on in the &lt;strong&gt;Styles&lt;/strong&gt; panel looks like this:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;h1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hotpink&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;letter-spacing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; .5rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 3rem&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;your CSS-in-JS framework probably expect it this way instead:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  background&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;hotpink&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  letterSpacing&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;.5rem&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  margin&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;2rem&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;  fontSize&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;3rem&#39;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Although the 2 are relatively similar, it&#39;s frustrating having to change semi-columns to commas, adding quotes, and swapping hyphen-separated property names with their camelCase equivalents.&lt;/p&gt;
&lt;p&gt;In Edge and Chrome, you don&#39;t have to. They both have an option that does the re-formatting for you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Right-click on any rule in the &lt;strong&gt;Styles&lt;/strong&gt; pane.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Copy all declarations as JS&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that you can also use &lt;strong&gt;Copy declaration as JS&lt;/strong&gt; if you only want one. But this feature really shines when you copy all declarations at once.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-rule-as-css-in-js.gif&quot; alt=&quot;Aimation showing the Styles pane in Edge, with the &amp;quot;Copy all declarations as JS&amp;quot; option being used, and then pasting the result in the Console to show that it is formatted.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Find out more about this feature on &lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/css/css-in-js&quot;&gt;the Microsoft DevTools docs website&lt;/a&gt;, or take a look at this short screencast:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=DCWSV0J5C8A&quot;&gt;https://www.youtube.com/watch?v=DCWSV0J5C8A&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Scroll an element into view</title>
    <link href="https://devtoolstips.org/tips/en/scroll-into-view/"/>
    <updated>2021-11-23T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/scroll-into-view/</id>
    <content type="html">&lt;p&gt;If the inspected web page is long with a lot of elements, and its DOM tree is big and complex, it&#39;s easy to get lost, not knowing where the selected element is in the page.&lt;/p&gt;
&lt;p&gt;DevTools has got your back here! You can easily reveal where the selected element is in the page by scrolling it into view:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Right-click the element in the &lt;strong&gt;Elements&lt;/strong&gt; panel (or &lt;strong&gt;Inspector&lt;/strong&gt; panel in Firefox).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Scroll into view&lt;/strong&gt; (in Firefox, you can also press &lt;kbd&gt;S&lt;/kbd&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/scroll-into-view.gif&quot; alt=&quot;Animation showing how the page is scrolled to reveal the selected element.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Take screenshots of your site in a device frame</title>
    <link href="https://devtoolstips.org/tips/en/take-in-device-screenshots/"/>
    <updated>2021-11-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/take-in-device-screenshots/</id>
    <content type="html">&lt;p&gt;Taking a photo of a mobile device or tablet is daunting as you have to deal with fingerprints, glare and focus issues. Using Device Emulation makes this a lot easier.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/take-in-device-screenshots.png&quot; alt=&quot;Screenshot of the devtoolstips.org website in an iPhone frame&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To take a screenshot of a web page inside a device frame, use either Chrome or Edge (or any Chromium browser):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In DevTools, turn on &lt;strong&gt;Device Emulation&lt;/strong&gt; by clicking the icon or pressing &lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;Shift&lt;/kbd&gt; + &lt;kbd&gt;M&lt;/kbd&gt; (&lt;kbd&gt;Cmd&lt;/kbd&gt; + &lt;kbd&gt;Shift&lt;/kbd&gt; + &lt;kbd&gt;M&lt;/kbd&gt; on Mac).&lt;/li&gt;
&lt;li&gt;Select a device from the Device dropdown menu. Be aware that not all devices have graphical frames.&lt;br /&gt;
&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/take-in-device-screenshots-devices-dropdown.png&quot; alt=&quot;The device dropdown menu open and showing all the options.&quot; /&gt;&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;…&lt;/strong&gt; button (&lt;strong&gt;More options&lt;/strong&gt;) and select &lt;strong&gt;Show device frame&lt;/strong&gt;.&lt;br /&gt;
&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/take-in-device-screenshots-show-device-frame.png&quot; alt=&quot;Turning on device frame in the more options menu of the Device emulation tool.&quot; /&gt;&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;…&lt;/strong&gt; button again and select &lt;strong&gt;Capture screenshot&lt;/strong&gt;.&lt;br /&gt;
&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/take-in-device-screenshots-capture-screenshot.png&quot; alt=&quot;Selecting the screenshot option from the More Options menu.&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&#39;s it, you now have a photo of your web page inside a device on transparent background.&lt;/p&gt;
&lt;p&gt;You can see this in action in the following video:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=ZViLMjxpqEE&quot;&gt;https://www.youtube.com/watch?v=ZViLMjxpqEE&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Take a screenshot of a single node</title>
    <link href="https://devtoolstips.org/tips/en/node-screenshot/"/>
    <updated>2021-11-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/node-screenshot/</id>
    <content type="html">&lt;p&gt;In Firefox, Chrome, Polypane and Edge DevTools, you can screenshot a single node from the page.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Elements&lt;/strong&gt; panel (or &lt;strong&gt;Inspector&lt;/strong&gt; panel in Firefox).&lt;/li&gt;
&lt;li&gt;Right-click on the node you want to screenshot.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Capture node screenshot&lt;/strong&gt; (or &lt;strong&gt;Screenshot node&lt;/strong&gt; in Firefox).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/node-screenshot.gif&quot; alt=&quot;Animation showing taking a node screenshot in Firefox.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In Polypane:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Click the &amp;quot;Make a screenshot&amp;quot; option.&lt;/li&gt;
&lt;li&gt;Select &amp;quot;Element&amp;quot;.&lt;/li&gt;
&lt;li&gt;Click the element on your page you want to screenshot.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/node-screenshot-polypane.gif&quot; alt=&quot;Animation showing taking a node screenshot in Polypane.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Automatically logging name and value in console.log()</title>
    <link href="https://devtoolstips.org/tips/en/automatically-log-name-and-value/"/>
    <updated>2021-11-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/automatically-log-name-and-value/</id>
    <content type="html">&lt;p&gt;Using the &lt;strong&gt;&lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/console/&quot;&gt;console&lt;/a&gt;&lt;/strong&gt; of DevTools you can to log some information to debug your JavaScript.&lt;/p&gt;
&lt;p&gt;The common way to do that is to add a &lt;code&gt;console.log()&lt;/code&gt; statement where you want to learn the value of a certain variable. In the following example the mouse position and how far the document has scrolled.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pageX&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; y &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pageY&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; top &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollTop&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;x&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;y&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;top&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The problem is that this results in lots of numbers in the console without explanations about what they are. If you wrap the values you want to read out in curly brackets &lt;code&gt;{}&lt;/code&gt;, the console automatically displays both the name and the value of the variable.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; x &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pageX&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; y &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;pageY&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; top &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;scrollTop&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;x&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;y&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;top&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/automatically-log-name-and-value.gif&quot; alt=&quot;Animation showing the different ways the variables are logged with and without curly braces.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=xTnqsA5vZX4&quot;&gt;https://www.youtube.com/watch?v=xTnqsA5vZX4&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Move panels to re-arrange them</title>
    <link href="https://devtoolstips.org/tips/en/move-panels/"/>
    <updated>2021-11-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/move-panels/</id>
    <content type="html">&lt;p&gt;Moving panels around the user interface can be very useful to make DevTools more unique to you and adapted to your needs.&lt;/p&gt;
&lt;p&gt;There are 2 ways that you can re-arrange panels in DevTools today: dragging them horizontally in the toolbar, to re-order them, and moving them between the top toolbar and the bottom (drawer) toolbar&lt;/p&gt;
&lt;h2 id=&quot;to-move-tabs-between-the-top-and-bottom-areas-(edge-only)&quot; tabindex=&quot;-1&quot;&gt;To move tabs between the top and bottom areas (Edge only) &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/move-panels/#to-move-tabs-between-the-top-and-bottom-areas-(edge-only)&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Right-click on any of the tabs.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Move to Bottom&lt;/strong&gt; or &lt;strong&gt;Move to Top&lt;/strong&gt; depending on where the tab is.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This only works in Edge at the moment is makes it super easy to see any 2 tools at once (more information about &lt;a href=&quot;https://blogs.windows.com/msedgedev/2021/09/14/edge-devtools-93-personalization/&quot;&gt;Edge personalization features&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/move-panels-1.gif&quot; alt=&quot;Animation in Edge DevTools showing the move to top/bottom menus.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;to-re-order-panels-by-dragging-(chrome%2C-edge%2C-firefox%2C-safari)&quot; tabindex=&quot;-1&quot;&gt;To re-order panels by dragging (Chrome, Edge, Firefox, Safari) &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/move-panels/#to-re-order-panels-by-dragging-(chrome%2C-edge%2C-firefox%2C-safari)&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Click and hold any of the tabs in the toolbar.&lt;/li&gt;
&lt;li&gt;Move the tab horizontally, left or right, until the desired location is reached.&lt;/li&gt;
&lt;li&gt;Release the mouse button. The new order will be persisted every time you open DevTools.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you use some tools more than others, this can be used to group them at the start of the toolbar for example.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/move-panels-2.gif&quot; alt=&quot;Animation in Firefox DevTools showing how to move panels in the toolbar.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Format console messages</title>
    <link href="https://devtoolstips.org/tips/en/format-console-messages/"/>
    <updated>2021-11-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/format-console-messages/</id>
    <content type="html">&lt;p&gt;You can use special formatters in the &lt;code&gt;console.log&lt;/code&gt; function to format logs just the way you want.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;%s&lt;/code&gt; to format a variable as a string.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;%d&lt;/code&gt; to format a variable as an integer.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;%f&lt;/code&gt; to format a variable as a float.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;%o&lt;/code&gt; to print a DOM element variable.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;%O&lt;/code&gt; to print an object variable.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As a bonus, the &lt;code&gt;%c&lt;/code&gt; formatter can also be used to &lt;a href=&quot;https://devtoolstips.org/tips/en/format-console-messages/style-console-messages.md&quot;&gt;style console messages with CSS properties&lt;/a&gt;!&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt; el &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;body&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;%c There are %d elements in %O&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;color:lime;background:black;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;childElementCount&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; el&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/format-console-messages.png&quot; alt=&quot;A formatted console message in Edge.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Simulate pseudo CSS classes</title>
    <link href="https://devtoolstips.org/tips/en/simulate-pseudo-classes/"/>
    <updated>2021-11-07T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/simulate-pseudo-classes/</id>
    <content type="html">&lt;p&gt;If you use &lt;code&gt;:hover&lt;/code&gt;, &lt;code&gt;:active&lt;/code&gt;, or other pseudo-classes in your CSS code, it can be tedious to test them. For example, having to hover over an element which is styled with the &lt;code&gt;:hover&lt;/code&gt; pseudo-class means that you can&#39;t use your mouse to inspect the element in DevTools at the same time.&lt;/p&gt;
&lt;p&gt;Thanks to DevTools, you can actually simulate these pseudo-classes without having to use your mouse or keyboard.&lt;/p&gt;
&lt;p&gt;To simulate a pseudo-class:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Inspect an element that has a pseudo-class defined in your CSS code.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Depending on your browser, do either of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Chrome, Edge, or Safari: in the &lt;strong&gt;Elements&lt;/strong&gt; tool, in the &lt;strong&gt;Styles&lt;/strong&gt; sidebar, click the &lt;code&gt;:hov&lt;/code&gt; button.&lt;/li&gt;
&lt;li&gt;In Firefox: in the &lt;strong&gt;Inspector&lt;/strong&gt; tool, in the &lt;strong&gt;Rules&lt;/strong&gt; sidebar, click the &lt;code&gt;:hov&lt;/code&gt; button.&lt;/li&gt;
&lt;li&gt;In Polypane: in the &lt;strong&gt;Elements&lt;/strong&gt; tool, click the rhombus icon.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The pseudo-class section appears.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select one, or more, pseudo-classes to simulate.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-pseudo-classes.png&quot; alt=&quot;The :hov button and the pseudo-class panel in Chrome DevTools&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Here is a screencast showing how to use pseudo-class simulation to check the hover, active, visited and focused state of a link without having to interact with the link using your keyboard or mouse:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=CgHuHYRyvXc&quot;&gt;https://www.youtube.com/watch?v=CgHuHYRyvXc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To try it out yourself, &lt;a href=&quot;https://codepen.io/codepo8/pen/WNEMaPO&quot;&gt;here is the demo page&lt;/a&gt; used in the video.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Zoom the DevTools UI to your liking</title>
    <link href="https://devtoolstips.org/tips/en/zoom-devtools-content/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/zoom-devtools-content/</id>
    <content type="html">&lt;p&gt;Do you find the UI of DevTools too small to comfortably work with? Because this UI is made of HTML and CSS, just like any other web pages, it can be zoomed in (or out) by the browser just like you can zoom in on web pages.&lt;/p&gt;
&lt;p&gt;To zoom the UI of DevTools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make sure it has focus first (click somewhere in DevTools).&lt;/li&gt;
&lt;li&gt;Use the &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;+&lt;/kbd&gt; and &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;-&lt;/kbd&gt; keyboard shortcuts to zoom in or out (replace &lt;kbd&gt;Ctrl&lt;/kbd&gt; with &lt;kbd&gt;Cmd&lt;/kbd&gt; on Mac).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/zoom-devtools-content.gif&quot; alt=&quot;Animation showing the UI of Chrome DevTools being zoomed in and out.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>See the page in 3D</title>
    <link href="https://devtoolstips.org/tips/en/see-the-page-in-3d/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/see-the-page-in-3d/</id>
    <content type="html">&lt;p&gt;See your page in 3 dimensions to quickly find out how deeply nested it is, fix z-index stacking issues, and performance issues.&lt;/p&gt;
&lt;h2 id=&quot;in-edge&quot; tabindex=&quot;-1&quot;&gt;In Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-the-page-in-3d/#in-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Open the Command Menu by pressing &lt;kbd&gt;ctrl+shift+P&lt;/kbd&gt; (or &lt;kbd&gt;cmd+shift+P&lt;/kbd&gt; on macOS).&lt;/li&gt;
&lt;li&gt;Type &amp;quot;3D&amp;quot; and press &lt;kbd&gt;Enter&lt;/kbd&gt;. The &lt;strong&gt;3D View&lt;/strong&gt; tool opens up.&lt;/li&gt;
&lt;li&gt;In the tool, choose which 3D mode you want to use: &lt;strong&gt;Z-index&lt;/strong&gt; (to visualize the stacking context tree), DOM (to visualize DOM nesting), and &lt;strong&gt;Composited Layers&lt;/strong&gt; (to visualize the layers created by the browser engine to paint the page in separate chunks).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-the-page-in-3d.png&quot; alt=&quot;The 3D view tool showing a page&#39;s z-index stacking tree as a 3d scene.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-chrome-or-safari&quot; tabindex=&quot;-1&quot;&gt;In Chrome or Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/see-the-page-in-3d/#in-chrome-or-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chrome and Safari also have a &lt;strong&gt;Layers&lt;/strong&gt; tool that provides the same information as Edge&#39;s Composited Layers 3D mode.&lt;/p&gt;
&lt;p&gt;You can learn more about Edge&#39;s &lt;strong&gt;3D View&lt;/strong&gt; tool in this video:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=BZAH8ZXhHZA&quot;&gt;https://www.youtube.com/watch?v=BZAH8ZXhHZA&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Cut down on console noise using live expressions</title>
    <link href="https://devtoolstips.org/tips/en/live-expressions/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/live-expressions/</id>
    <content type="html">&lt;p&gt;Using the &lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/console/&quot;&gt;Console&lt;/a&gt; of DevTools to log information that changes a lot is a bad idea. First of all, you flood it with information. Secondly, it can impact the performance of your product. And last but not least, you are most likely to only log this information to debug your project and end users should never get that information.&lt;/p&gt;
&lt;p&gt;An excellent alternative to logging a lot of information are &lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/console/live-expressions&quot;&gt;live expressions&lt;/a&gt;. To add a new live expression do the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click the eye icon in DevTools &lt;img src=&quot;https://devtoolstips.org/tips/assets/img/live-expressions-eye-icon.png&quot; alt=&quot;The eye button in DevTools&quot; /&gt;&lt;/li&gt;
&lt;li&gt;This gives you an entry field to type in any JavaScript expression. &lt;img src=&quot;https://devtoolstips.org/tips/assets/img/live-expressions-field.png&quot; alt=&quot;The field to enter your live expression&quot; /&gt;&lt;/li&gt;
&lt;li&gt;Save the expression by clicking outside the field or press &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt; on Mac or &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt; on Windows/Linux.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This will pin the expression on top of the Console and show you the value returned from it. Any change will show live below the expression.&lt;/p&gt;
&lt;p&gt;You can use this, for example, to resize the window to a certain size by monitoring the &lt;code&gt;outerWidth&lt;/code&gt; and &lt;code&gt;outerHeight&lt;/code&gt; properties.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerWidth&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; x &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;outerHeight&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/live-expressions-window-resize.gif&quot; alt=&quot;Monitoring the window size using live expressions.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;You can set as many live expressions as you want, and you can remove them by clicking the &lt;code&gt;x&lt;/code&gt; icon next to them.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Easily change CSS number values from the keyboard in increments of 0.1, 1, 10, 100</title>
    <link href="https://devtoolstips.org/tips/en/increment-css-number-values/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/increment-css-number-values/</id>
    <content type="html">&lt;p&gt;When playing with styling or layout code in DevTools, it&#39;s useful to be able to change widths, margins, and other CSS number values quickly.&lt;/p&gt;
&lt;p&gt;Manually entering new numbers works of course, but it gets in the way of creativity a little bit.&lt;/p&gt;
&lt;p&gt;In DevTools you can change numbers by using the arrow keys on your keyboard, this way you can easily and quickly test changes while checking the result in real time in the page. But there&#39;s more, you can also hold the various control keys to change the speed at which the numbers increment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Focus a CSS value in the &lt;strong&gt;Styles&lt;/strong&gt;/&lt;strong&gt;Rules&lt;/strong&gt;/&lt;strong&gt;Elements&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Make sure the text cursor is on a number.&lt;/li&gt;
&lt;li&gt;Press the &lt;strong&gt;Up&lt;/strong&gt; or &lt;strong&gt;Down&lt;/strong&gt; arrow button on the keyboard to increment, or decrement the number by 1.&lt;/li&gt;
&lt;li&gt;Hold &lt;kbd&gt;Shift&lt;/kbd&gt; at the same time to increment by 10.&lt;/li&gt;
&lt;li&gt;Or, hold &lt;kbd&gt;Alt&lt;/kbd&gt; to increment by 0.1.&lt;/li&gt;
&lt;li&gt;Or, hold &lt;kbd&gt;Ctrl&lt;/kbd&gt; to increment by 100.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/increment-css-number-values.gif&quot; alt=&quot;Animation of the Styles panel in Edge showing how numbers can be changed in various increments.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Get contextual DevTools help</title>
    <link href="https://devtoolstips.org/tips/en/get-contextual-help/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/get-contextual-help/</id>
    <content type="html">&lt;p&gt;Edge has a feature called the &lt;strong&gt;DevTools Tooltips&lt;/strong&gt; that gives you help about the different tools right inside of DevTools.&lt;/p&gt;
&lt;p&gt;There are several ways to enable it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Press &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;H&lt;/kbd&gt; (or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;H&lt;/kbd&gt; on mac),&lt;/li&gt;
&lt;li&gt;or click on the three-dots menu icon, then Help, then Toggle the DevTools Tooltips,&lt;/li&gt;
&lt;li&gt;or using the command menu (&lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt;) and typing &amp;quot;tooltips&amp;quot;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When tooltips are enabled, you can hover over them to get documentation about the tools.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/get-contextual-help.gif&quot; alt=&quot;Animation of the DevTools tooltips in Edge.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find and export CSS changes</title>
    <link href="https://devtoolstips.org/tips/en/find-css-changes/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-css-changes/</id>
    <content type="html">&lt;p&gt;If you spent time changing CSS in DevTools, either in the Rules panel (in Firefox), or in the Sources or Styles panels (in Chrome or Edge), and you don&#39;t remember all of the changes you made, you can find and extract them easily from:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox or Safari:
&lt;ul&gt;
&lt;li&gt;The Changes panel (in the Inspector), which allows you to copy all changes, or copy a given CSS rule&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Chrome or Edge:
&lt;ul&gt;
&lt;li&gt;The Changes panel (which you can open from the command menu by typing &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt; or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;P&lt;/kbd&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-css-changes.png&quot; alt=&quot;The Changes panel in Firefox showing a diff-like view of all the CSS changes.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Use commands to do things faster</title>
    <link href="https://devtoolstips.org/tips/en/execute-commands/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/execute-commands/</id>
    <content type="html">&lt;p&gt;There is a command menu in Edge and Chrome that allows you to quickly access many different features of DevTools without having to navigate the UI.&lt;/p&gt;
&lt;p&gt;Press &lt;kbd&gt;Ctrl+Shift+P&lt;/kbd&gt; on Windows or Linux (or &lt;kbd&gt;Cmd+Shift+P&lt;/kbd&gt; on macOS) to open the command menu, and just start typing.&lt;/p&gt;
&lt;p&gt;You can use this to, for example, switch to a different panel by typing its name, change the color theme, change settings, disable javascript, etc.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/execute-commands.png&quot; alt=&quot;Edge&#39;s command menu.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Evaluate XPath to find elements in the page</title>
    <link href="https://devtoolstips.org/tips/en/evaluate-xpath/"/>
    <updated>2021-10-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/evaluate-xpath/</id>
    <content type="html">&lt;p&gt;DevTools supports 2 ways to evaluate &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/XPath&quot;&gt;XPath&lt;/a&gt; expressions to help you locate elements in the page. All browsers support those 2 ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;From the Elements (or Inspector) panel:
&lt;ul&gt;
&lt;li&gt;Click anywhere in the panel to make sure it has focus&lt;/li&gt;
&lt;li&gt;Press &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;F&lt;/kbd&gt; (or &lt;kbd&gt;cmd&lt;/kbd&gt;+&lt;kbd&gt;F&lt;/kbd&gt; on Mac) to focus the search field&lt;/li&gt;
&lt;li&gt;Enter your XPath expression and press enter to find the elements that match&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/evaluate-xpath-1.png&quot; alt=&quot;The Inspector panel in Firefox showing the search field with an XPath expression.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Note that you can also &lt;a href=&quot;https://devtoolstips.org/tips/en/evaluate-xpath/copy-element-xpath.md&quot;&gt;copy the XPath expression from any element in DevTools&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;From the Console panel:
&lt;ul&gt;
&lt;li&gt;You can use the built-in &lt;code&gt;$x()&lt;/code&gt; helper function like this:&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token function&quot;&gt;$x&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;//div/div/label&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/evaluate-xpath-2.png&quot; alt=&quot;The Console panel in Safari showing an array of elements, as the result of executing the above function.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Store a node as a variable to use it in the console</title>
    <link href="https://devtoolstips.org/tips/en/store-node-as-variable/"/>
    <updated>2021-10-23T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/store-node-as-variable/</id>
    <content type="html">&lt;p&gt;If you want to use a DOM node from the page in the console:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Right-click the node in the &lt;strong&gt;Elements&lt;/strong&gt; (or &lt;strong&gt;Inspector&lt;/strong&gt; in Firefox).&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Store as global variable&lt;/strong&gt; (or &lt;strong&gt;Use in Console&lt;/strong&gt; in Firefox).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;strong&gt;Console&lt;/strong&gt; opens up, pre-filled with a new variable name (something like &lt;code&gt;temp1&lt;/code&gt;) which you can use to refer to the node any time you want.&lt;/p&gt;
&lt;p&gt;Note that if you only want to refer to the currently selected node (and not create a new variable), you can also &lt;a href=&quot;https://devtoolstips.org/tips/en/store-node-as-variable/get-current-element-in-console.md&quot;&gt;use &lt;code&gt;$0&lt;/code&gt; in the console&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/store-node-as-variable.png&quot; alt=&quot;Firefox&#39;s &amp;quot;use in console&amp;quot; context menu option in the Inspector, and also showing the Console with a couple of tempN variables.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Thank you &lt;a href=&quot;https://austingil.com/&quot;&gt;Austin Gil&lt;/a&gt; for sharing this tip on &lt;a href=&quot;https://twitter.com/Stegosource/status/1451294683024355328&quot;&gt;Twitter&lt;/a&gt;!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Console.log() for the web with logpoints</title>
    <link href="https://devtoolstips.org/tips/en/use-logpoints/"/>
    <updated>2021-10-20T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/use-logpoints/</id>
    <content type="html">&lt;p&gt;Using the &lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/console/&quot;&gt;console&lt;/a&gt; to log some information is a very common way to debug your JavaScript. But you can also log information in any web site using &lt;strong&gt;Logpoints&lt;/strong&gt; in the &lt;a href=&quot;https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/sources/&quot;&gt;sources&lt;/a&gt; panel.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/use-logpoints.png&quot; alt=&quot;Setting a logpoint in the sources tool.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Here&#39;s how to do it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In the Sources panel (or Debugger in Firefox), open a JavaScript file and right-click any line number.&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;Add logpoint&lt;/code&gt; to open the editor&lt;/li&gt;
&lt;li&gt;In the editor, enter the JavaScript expression you&#39;d like to log.&lt;/li&gt;
&lt;li&gt;Hit Enter to save and a badge shows on the line number.&lt;/li&gt;
&lt;li&gt;Go to the console, interact with the site and every time this line executes, you see the result of the logpoint expression.&lt;/li&gt;
&lt;li&gt;If you don&#39;t want to log information any longer, click the Logpoint again to remove it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Logpoints are a way to inject a &lt;code&gt;console.log()&lt;/code&gt; into any web site without editing its source code.&lt;/p&gt;
&lt;p&gt;You can see this in action in this video on YouTube:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=DRRezUZvZ6I&quot;&gt;https://www.youtube.com/watch?v=DRRezUZvZ6I&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Debug popups that appear on hover using JS</title>
    <link href="https://devtoolstips.org/tips/en/debug-js-hover/"/>
    <updated>2021-10-20T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debug-js-hover/</id>
    <content type="html">&lt;p&gt;Have you ever been frustrated because you couldn&#39;t style a popup or tooltip that appeared on hover? If it uses JavaScript to get displayed, it&#39;s hard to style without modifying the code to make it stay visible.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Switch the &lt;strong&gt;Sources&lt;/strong&gt;/&lt;strong&gt;Debugger&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Then hover the element in the page so the popup appears, and leave the mouse there.&lt;/li&gt;
&lt;li&gt;Now press &lt;code&gt;F8&lt;/code&gt; to pause the debugger.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&#39;s it! The JS engine will pause and freeze the state of the page. You can now switch back to &lt;strong&gt;Elements&lt;/strong&gt;/&lt;strong&gt;Inspector&lt;/strong&gt; and style the popup content!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debug-js-hover.gif&quot; alt=&quot;Animation showing how to pause the debugger with F8 while a tooltip is visible to then style it in the Inspector panel of Firefox.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Thank you to &lt;a href=&quot;https://twitter.com/samselikoff&quot;&gt;Sam Selikoff&lt;/a&gt; for &lt;a href=&quot;https://twitter.com/samselikoff/status/1441142046492807176&quot;&gt;tweeting&lt;/a&gt; about this tip and making a youtube video about it too:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=aNZ9ci_1gtM&quot;&gt;https://www.youtube.com/watch?v=aNZ9ci_1gtM&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Monitor all events dispatched on an element</title>
    <link href="https://devtoolstips.org/tips/en/monitor-element-events/"/>
    <updated>2021-10-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/monitor-element-events/</id>
    <content type="html">&lt;p&gt;You can use the &lt;code&gt;monitorEvents&lt;/code&gt; global function in the &lt;strong&gt;Console&lt;/strong&gt; panel to log all of the events dispatched on a particular element.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select an element in the &lt;strong&gt;Elements&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Console&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;monitorEvents($0, &#39;key&#39;);&lt;/code&gt; and hit Enter.&lt;/li&gt;
&lt;li&gt;Interact with the selected element in the page to dispatch events.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can replace &lt;code&gt;$0&lt;/code&gt; with a reference to any other element. &lt;code&gt;$0&lt;/code&gt; is just a shortcut to the currently selected element.&lt;/p&gt;
&lt;p&gt;You can also change &lt;code&gt;key&lt;/code&gt; to other event types like &lt;code&gt;mouse&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/monitor-element-events.gif&quot; alt=&quot;Animation showing how events get automatically logged when using the monitorEvents function.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Thank you to &lt;a href=&quot;https://github.com/mgechev&quot;&gt;Minko Gechev&lt;/a&gt; for &lt;a href=&quot;https://twitter.com/mgechev/status/1447419251120279558&quot;&gt;tweeting&lt;/a&gt; about this tip.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit CSS shadow visually</title>
    <link href="https://devtoolstips.org/tips/en/edit-shadow/"/>
    <updated>2021-10-11T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-shadow/</id>
    <content type="html">&lt;p&gt;If you don&#39;t remember the CSS syntax for the &lt;code&gt;box-shadow&lt;/code&gt; property (and who does!), then Chrome and Edge can help you with their visual shadow editor!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select an element that has some shadow applied.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Styles&lt;/strong&gt; pane.&lt;/li&gt;
&lt;li&gt;Click on the little shadow editor icon next to the &lt;code&gt;box-shadow&lt;/code&gt; property value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-shadow.gif&quot; alt=&quot;Animation showing the shadow editor in Edge&#39;s Styles pane.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Hide resources loaded by extensions in the Network panel</title>
    <link href="https://devtoolstips.org/tips/en/hide-extension-resources/"/>
    <updated>2021-10-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/hide-extension-resources/</id>
    <content type="html">&lt;p&gt;If you want to hide scripts and other resources loaded by browser extensions in the &lt;strong&gt;Network&lt;/strong&gt; panel, use the &lt;code&gt;-scheme:chrome-extension&lt;/code&gt; pattern in the filter input box.&lt;/p&gt;
&lt;p&gt;Credits go to &lt;a href=&quot;https://www.coolcomputerclub.com/&quot;&gt;Sunil&lt;/a&gt; for his &lt;a href=&quot;https://twitter.com/threepointone/status/1446064032407080966&quot;&gt;post on twitter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/hide-extension-resources.jpg&quot; alt=&quot;The Network panel in Chrome DevTools showing the pattern used in the filter input box.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Jump from a CSS variable usage to where it is defined</title>
    <link href="https://devtoolstips.org/tips/en/jump-to-css-variable/"/>
    <updated>2021-09-27T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/jump-to-css-variable/</id>
    <content type="html">&lt;p&gt;CSS &lt;strong&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties&quot;&gt;custom properties&lt;/a&gt;&lt;/strong&gt; (also called &lt;strong&gt;variables&lt;/strong&gt;) are very useful to avoid repeating values in CSS, like colors for example.&lt;/p&gt;
&lt;p&gt;You can define and use a custom property as shown below:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;rule-1&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;--my-main-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; blue&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;rule-2&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--my-main-color&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sometimes, it can be hard in DevTools to see both the place where the variable is used &lt;strong&gt;and&lt;/strong&gt; the place where it is defined. There may be a lot of rules and properties that apply to an element, requiring a lot of scrolling and searching.&lt;/p&gt;
&lt;p&gt;In Edge and Chrome, you can simply click on a &lt;code&gt;var(--foo)&lt;/code&gt; function to jump to where the &lt;code&gt;--foo&lt;/code&gt; variable is defined!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Edge or Chrome, select an element in the &lt;strong&gt;Elements&lt;/strong&gt; panels which has CSS rules applied that use custom properties.&lt;/li&gt;
&lt;li&gt;Hover over the property name inside the &lt;code&gt;var()&lt;/code&gt; function. You can see the value in a tooltip.&lt;/li&gt;
&lt;li&gt;Click on the property name.&lt;/li&gt;
&lt;li&gt;The Styles panel scrolls to where the property is defined and highlights it for a second.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/jump-to-css-variable.gif&quot; alt=&quot;Animation of clicking on a custom property link in the Styles panel in Edge.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Pause script execution when the DOM changes</title>
    <link href="https://devtoolstips.org/tips/en/break-on-dom-changes/"/>
    <updated>2021-09-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/break-on-dom-changes/</id>
    <content type="html">&lt;p&gt;If you want to know what JavaScript code removes, adds, or modifies a DOM element in the page, you can use DOM breakpoints in DevTools. You can choose to break on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Subtree modification: this pauses execution when any element in the subtree of the selected element is modified (added, removed, or changed attribute).&lt;/li&gt;
&lt;li&gt;Attribute modification: this pauses execution when an attribute of the selected element is modified.&lt;/li&gt;
&lt;li&gt;Node removal: this pauses execution when the selected node is removed from the DOM tree.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is useful if you don&#39;t know the codebase you are debugging for example.&lt;/p&gt;
&lt;p&gt;To add a DOM breakpoint:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;Inspector/Elements&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Find the node which you want to add the breakpoint on.&lt;/li&gt;
&lt;li&gt;Open the contextual menu (right-click).&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Break on&lt;/strong&gt; sub menu and choose the type of breakpoint you want to set.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/break-on-dom-changes.png&quot; alt=&quot;The Elements panel in Edge showing the &amp;quot;Break on&amp;quot; contextual menu on the selected node.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Once the requested DOM modification occurs, the JavaScript execution will pause and DevTools will navigate to the Sources/Debugger panel, showing the right line of code where execution is paused.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Convert color formats</title>
    <link href="https://devtoolstips.org/tips/en/convert-color-formats/"/>
    <updated>2021-09-20T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/convert-color-formats/</id>
    <content type="html">&lt;p&gt;Colors in CSS can be expressed in a number of different formats: keyword (e.g. &lt;code&gt;blue&lt;/code&gt;), RGB, HSL, hexadecimal, and others.&lt;/p&gt;
&lt;p&gt;In DevTools, you can easily convert from one format to the next.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find an element in the &lt;strong&gt;Elements&lt;/strong&gt; panel (or &lt;strong&gt;Inspector&lt;/strong&gt; panel in Firefox) that has some CSS color properties applied.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Styles&lt;/strong&gt; panel (or &lt;strong&gt;Rules&lt;/strong&gt; in Firefox), hold &lt;strong&gt;Shift&lt;/strong&gt; and click on the color swatch (the little colored circle next to the color value) to cycle through the different formats.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/convert-color-formats.gif&quot; alt=&quot;Animation of the rules panel in Firefox, showing the color conversion.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Change the color theme of DevTools</title>
    <link href="https://devtoolstips.org/tips/en/change-color-theme/"/>
    <updated>2021-09-20T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/change-color-theme/</id>
    <content type="html">&lt;p&gt;Chrome, Firefox and Safari all have a light and dark theme for their DevTools. On top of these two themes, Edge also has about 10 VS Code themes such as Monokai and Solarized Dark.&lt;/p&gt;
&lt;p&gt;To change the theme based on your preference:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox:
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Settings&lt;/strong&gt; page (press &lt;kbd&gt;F1&lt;/kbd&gt;).&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Themes&lt;/strong&gt; setting, choose between &lt;strong&gt;Light&lt;/strong&gt;, &lt;strong&gt;Dark&lt;/strong&gt;, or &lt;strong&gt;Auto&lt;/strong&gt; to match the theme of your operating system.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Chrome:
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Settings&lt;/strong&gt; page (press &lt;kbd&gt;F1&lt;/kbd&gt;).&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Preferences&lt;/strong&gt; section, under &lt;strong&gt;Appearance&lt;/strong&gt;, use the &lt;strong&gt;Theme&lt;/strong&gt; dropdown to choose between &lt;strong&gt;Light&lt;/strong&gt;, &lt;strong&gt;Dark&lt;/strong&gt;, or &lt;strong&gt;System preference&lt;/strong&gt; to match the theme of your operating system.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Edge:
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Settings&lt;/strong&gt; page (press &lt;kbd&gt;F1&lt;/kbd&gt;).&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Preferences&lt;/strong&gt; section, under &lt;strong&gt;Appearance&lt;/strong&gt;, use the &lt;strong&gt;Theme&lt;/strong&gt; dropdown to choose one of the available &lt;strong&gt;Light&lt;/strong&gt; or &lt;strong&gt;Dark&lt;/strong&gt; themes, or &lt;strong&gt;System preference&lt;/strong&gt; to match the theme of your operating system.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Safari:
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Settings&lt;/strong&gt; page (press &lt;kbd&gt;F1&lt;/kbd&gt;).&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Appearance&lt;/strong&gt; section choose between &lt;strong&gt;Light&lt;/strong&gt;, &lt;strong&gt;Dark&lt;/strong&gt;, or &lt;strong&gt;System&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/change-color-theme.png&quot; alt=&quot;the settings panel in Edge showing the Theme drop-down.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Force PWA periodic background syncs</title>
    <link href="https://devtoolstips.org/tips/en/force-pwa-periodic-sync/"/>
    <updated>2021-09-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/force-pwa-periodic-sync/</id>
    <content type="html">&lt;p&gt;The &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Web_Periodic_Background_Synchronization_API&quot;&gt;periodic background sync API&lt;/a&gt;, available to PWAs is a great way to fetch new content while the user isn&#39;t on the site, and while they have access to the network, to make sure they have the latest content when they come back to the app.&lt;/p&gt;
&lt;p&gt;It can be hard to debug though, as the sync only happen after the minimum interval has passed, and the browser thinks that now is a good time to trigger the sync.&lt;/p&gt;
&lt;p&gt;Thankfully, there is a way in Chrome and Edge to force the sync, so you don&#39;t have to wait for the browser to do it.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;Application&lt;/strong&gt; panel.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Service Workers&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;Periodic Sync&lt;/strong&gt; input.&lt;/li&gt;
&lt;li&gt;Enter the tag name for your registered sync, and click the &lt;strong&gt;Periodic Sync&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/force-pwa-periodic-sync.png&quot; alt=&quot;The Application panel in Edge showing the periodic sync input and buttons.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Play a sound when a line of JavaScript is executed</title>
    <link href="https://devtoolstips.org/tips/en/play-sound-on-js-execution/"/>
    <updated>2021-09-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/play-sound-on-js-execution/</id>
    <content type="html">&lt;p&gt;Sometimes pausing execution when a line of JavaScript is executed is too much, sometimes you only want to know that the line was executed at all, not pause there.&lt;/p&gt;
&lt;p&gt;To do this you can add &lt;code&gt;console.log()&lt;/code&gt; statements in your code, or &lt;a href=&quot;https://devtoolstips.org/tips/en/play-sound-on-js-execution/use-logpoints.md&quot;&gt;use logpoints&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In Safari, you can play an audio beep instead! This way you can hear that the line got executed, and your console doesn&#39;t get cluttered with more messages.&lt;/p&gt;
&lt;p&gt;To add an audio breakpoint:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a breakpoint on a line of code by clicking in the line number gutter.&lt;/li&gt;
&lt;li&gt;Right-click on the breakpoint and select &lt;strong&gt;Edit breakpoint&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add action&lt;/strong&gt; and select &lt;strong&gt;Play sound&lt;/strong&gt; from the action dropdown.&lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;Automatically continue after evaluating&lt;/strong&gt; option to avoid pausing on this line.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And that&#39;s it! Now every time this line is executed, an audio beep will be played.&lt;/p&gt;
&lt;p&gt;You can remove the breakpoint by right-clicking on it and selecting &lt;strong&gt;Delete Breakpoint&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/play-sound-on-js-execution.gif&quot; alt=&quot;Animation showing how to add the audio breakpoint in Safari Web Inspector.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Visualize the screen reader order for elements within the page</title>
    <link href="https://devtoolstips.org/tips/en/visualize-screenreader-order/"/>
    <updated>2021-08-30T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/visualize-screenreader-order/</id>
    <content type="html">&lt;p&gt;Some users make use of assistive technology, like screen readers (e.g. Narrator, VoiceOver, NVDA), to consume the content of web pages and interact with them. If a screen reader presents the content in an incorrect order, such as presenting the content of a section before its title, this might give users a confusing experience.&lt;/p&gt;
&lt;p&gt;Incorrect ordering can occur if you use CSS to reorder elements visually in a way that is not reflected in the source order. To learn more, see &lt;a href=&quot;https://adrianroselli.com/2015/10/html-source-order-vs-css-display-order.html&quot;&gt;HTML Source Order vs CSS Display Order&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You should ensure that the source order matches the display order, and you can use DevTools to check.&lt;/p&gt;
&lt;h2 id=&quot;in-edge-and-chrome&quot; tabindex=&quot;-1&quot;&gt;In Edge and Chrome &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/visualize-screenreader-order/#in-edge-and-chrome&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the DOM element for which you want to check the source order.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Accessibility&lt;/strong&gt; tab in the tool&#39;s sidebar.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under the &lt;strong&gt;Source Order Viewer&lt;/strong&gt; section, click &lt;strong&gt;Show source order&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;An overlay appears on the page, and shows the order in which elements appear in the source&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/visualize-screenreader-order.png&quot; alt=&quot;The source order viewer in Chrome, showing numbered boxes around elements&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-safari&quot; tabindex=&quot;-1&quot;&gt;In Safari &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/visualize-screenreader-order/#in-safari&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Elements&lt;/strong&gt; tool in Safari Web Inspector allows you to visualize the source order for flexbox containers.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Elements&lt;/strong&gt; tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;strong&gt;Layout&lt;/strong&gt; tab in the sidebar.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under &lt;strong&gt;Flexbox&lt;/strong&gt;, select the &lt;strong&gt;Order Numbers&lt;/strong&gt; checkbox.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Below, find the flexbox container for which you want to visualize the source order and select the checkbox.&lt;/p&gt;
&lt;p&gt;An overlay apppears on the page, showing lines around the flexbox container, the flexbox items, and labels indicating the source order of flexbox items.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/visualize-screenreader-order-safari.png&quot; alt=&quot;The source order viewer in Safari, showing numbered boxes around elements&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Block resources to test your site without CSS or JavaScript</title>
    <link href="https://devtoolstips.org/tips/en/block-resources/"/>
    <updated>2021-08-19T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/block-resources/</id>
    <content type="html">&lt;p&gt;The various resources loaded by your site aren&#39;t always guaranteed to reach your users when they visit your site. Network problems can occur, JavaScript may be disabled, a CDN may be down, or the browser can decide to block a resource.&lt;/p&gt;
&lt;p&gt;It&#39;s useful to test how your site looks when this occurs. It may also be useful to compare the performance of your site with and without certain resources.&lt;/p&gt;
&lt;p&gt;With DevTools you can block individual URLs or more global patterns.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;With Chrome or Edge:
&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Network&lt;/strong&gt; panel&lt;/li&gt;
&lt;li&gt;Right-click on the request you want to block and select &lt;strong&gt;Block request URL&lt;/strong&gt; (you can also select &lt;strong&gt;Block request domain&lt;/strong&gt; to block all resources from the same domain)&lt;/li&gt;
&lt;li&gt;Reload the page&lt;/li&gt;
&lt;li&gt;You can also use the &lt;strong&gt;Network request blocking&lt;/strong&gt; panel (which opens automatically when you block a request) to add, edit and remove URLs or URL patterns&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/block-resources-1.png&quot; alt=&quot;The Network panel in Edge showing the contextual menu with the &amp;quot;block request url&amp;quot; item.&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;With Firefox:
&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Network&lt;/strong&gt; panel&lt;/li&gt;
&lt;li&gt;Right-click on the request you want to block and select &lt;strong&gt;Block URL&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Reload the page&lt;/li&gt;
&lt;li&gt;You can also use the &lt;strong&gt;Blocking&lt;/strong&gt; sidebar (which opens automatically when you block a request) to add, edit and remove URLs or URL patterns&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/block-resources-2.png&quot; alt=&quot;The Network panel in Firefox showing the contextual menu with the &amp;quot;block url&amp;quot; item and the &amp;quot;blocking&amp;quot; sidebar.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Prototype content changes with designMode</title>
    <link href="https://devtoolstips.org/tips/en/prototype-content-changes-with-designmode/"/>
    <updated>2021-08-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/prototype-content-changes-with-designmode/</id>
    <content type="html">&lt;p&gt;When creating or modifying a design prototype for the web, you may want to quickly edit content in the browser without having to find the relevant code.&lt;/p&gt;
&lt;p&gt;When you turn on &lt;code&gt;designMode&lt;/code&gt; for the document or a given element, all associated text becomes editable directly in the browser. Images and other page content can be deleted, too. This is a quick way to prototype design changes such as seeing how a page responds to very long or very short headline copy.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;designMode&lt;/code&gt; is not a DevTools-specific feature, as it is defined as part of the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode&quot;&gt;Web API&lt;/a&gt;. However, toggling &lt;code&gt;designMode&lt;/code&gt; via the DevTools Console is a convenient way to temporarily make the page editable.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the Console&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;document.designMode=&amp;quot;on&amp;quot;&lt;/code&gt; and press Enter&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Turn off &lt;code&gt;designMode&lt;/code&gt; with the expression &lt;code&gt;document.designMode=&amp;quot;off&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In Polypane these steps are not neede and it&#39;s enough to open the &lt;strong&gt;Debug tools&lt;/strong&gt; and activating &lt;strong&gt;Edit content&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Changes are not persisted and will revert on page close or refresh.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/prototype-content-changes-with-designmode.gif&quot; alt=&quot;Animation of editable web page with designMode on.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Capture node creation stack traces</title>
    <link href="https://devtoolstips.org/tips/en/capture-node-creation-stacks/"/>
    <updated>2021-07-27T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/capture-node-creation-stacks/</id>
    <content type="html">&lt;p&gt;Have you ever wanted to know what caused a specific DOM node or element to be created in the page?&lt;br /&gt;
When working on a site that uses a lot of JavaScript and especially when you don&#39;t know the codebase, this can be a life saver.&lt;/p&gt;
&lt;p&gt;It turns out there is a way to do this automatically without having to set breakpoints in the code at all. It is a hidden experiment for now so you will need to first enable it in Chrome or Edge.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Go through the following steps once to enable the experiment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the DevTools settings (press F1, or use the gear icon in the toolbar)&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Experiments&lt;/strong&gt; tab&lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;Capture node creation stacks&lt;/strong&gt; box&lt;/li&gt;
&lt;li&gt;Reload DevTools&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make sure DevTools is opened when using the website so that stack traces get captured. When you want to know what created a node:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select the node in the Elements panel&lt;/li&gt;
&lt;li&gt;In the sidebar, select the &lt;strong&gt;Stack Trace&lt;/strong&gt; panel (you might have to first click on the &lt;strong&gt;More tabs&lt;/strong&gt; chevron &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; to see the tab)&lt;/li&gt;
&lt;li&gt;The stack of JavaScript calls that led to the node creation (if any) should be displayed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/capture-node-creation-stacks.png&quot; alt=&quot;Edge DevTools&#39; Elements panel with the Stack Trace sidebar visible, showing a stack of Vue JS function calls that created an element on the TODOMVC sample app.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Throttle the network speed to test your website on slower connections</title>
    <link href="https://devtoolstips.org/tips/en/throttle-network-speed/"/>
    <updated>2021-07-20T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/throttle-network-speed/</id>
    <content type="html">&lt;p&gt;While you may develop your website on a fast network connection at home or at work, your users may not be able to use it with an equally fast connection. Perhaps they&#39;re in a moving car, or on the subway, or they don&#39;t have access to high-speed internet at their place. Whatever it is, they may experience your site very differently than you do because of this.&lt;/p&gt;
&lt;p&gt;Testing your site with a slower connection helps you understand how it loads and appears on the screen.&lt;/p&gt;
&lt;p&gt;Firefox, Chrome and Edge let you simulate slower network connections to do this.&lt;/p&gt;
&lt;p&gt;To throttle your connection:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Network&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;Use the dropdown that says &lt;code&gt;No throttling&lt;/code&gt; and choose any of the other values.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can also do this from the &lt;a href=&quot;https://devtoolstips.org/tips/en/throttle-network-speed/simulate-devices.md&quot;&gt;device simulation&lt;/a&gt; mode by using the same dropdown there.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/throttle-network-speed.png&quot; alt=&quot;The Network panel in Edge showing the network throttling drop-down.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Emulation options&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Network&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Toggle between the different network speed settings&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/throttle-network-speed-2.png&quot; alt=&quot;The Network option in Polypane.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit CSS absolute and relative positions by dragging points in the page</title>
    <link href="https://devtoolstips.org/tips/en/edit-position/"/>
    <updated>2021-07-19T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-position/</id>
    <content type="html">&lt;p&gt;Firefox features a position editor that lets you move elements in the page by drag and drop. This works with elements that are positioned in CSS with &lt;code&gt;position:relative&lt;/code&gt; or &lt;code&gt;position:absolute&lt;/code&gt; and that have at least one of &lt;code&gt;top&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt;, &lt;code&gt;bottom&lt;/code&gt; and &lt;code&gt;left&lt;/code&gt; defined.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select an element with &lt;code&gt;position:relative&lt;/code&gt; or &lt;code&gt;position:absolute&lt;/code&gt; applied to it in the Inspector panel.&lt;/li&gt;
&lt;li&gt;Open the Layout sidebar panel, and scroll down to the Box Model section.&lt;/li&gt;
&lt;li&gt;Find the &amp;quot;Edit Position&amp;quot; icon and click it.&lt;/li&gt;
&lt;li&gt;Use the handles in the page to move the element around, within its positioned ancestor.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Reposition_elements_in_the_page&quot;&gt;Learn more about this tool here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-position.gif&quot; alt=&quot;Animation of the geometry editor in Firefox, toggling it from the Layout panel, and then dragging top and left points to move the element in the page.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Copy an element&#39;s XPath expression</title>
    <link href="https://devtoolstips.org/tips/en/copy-element-xpath/"/>
    <updated>2021-07-13T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/copy-element-xpath/</id>
    <content type="html">&lt;p&gt;You can easily copy an element&#39;s &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/XPath&quot;&gt;XPath&lt;/a&gt; expression from DevTools. This is useful if you need this expression for an automated test for example.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the Elements (or Inspector) panel&lt;/li&gt;
&lt;li&gt;Use the context-menu (right-click) on the element you care about&lt;/li&gt;
&lt;li&gt;Go into the Copy sub-menu&lt;/li&gt;
&lt;li&gt;Choose the Xpath option&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that you can then use this xpath expression to &lt;a href=&quot;https://devtoolstips.org/tips/en/copy-element-xpath/evaluate-xpath.md&quot;&gt;find elements again in DevTools&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-element-xpath.png&quot; alt=&quot;The Elements panel in Edge showing the copy xpath option in the contextual menu.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Convert font property units</title>
    <link href="https://devtoolstips.org/tips/en/convert-font-units/"/>
    <updated>2021-07-12T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/convert-font-units/</id>
    <content type="html">&lt;p&gt;Font CSS properties such as &lt;code&gt;font-size&lt;/code&gt;, &lt;code&gt;line-height&lt;/code&gt; or &lt;code&gt;letter-spacing&lt;/code&gt; can be expressed in multiple different length units (like many other CSS properties).&lt;/p&gt;
&lt;p&gt;Firefox, Chrome and Edge allow you to convert values between these units easily.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox
&lt;ul&gt;
&lt;li&gt;Find an element in the Inspector panel that has font properties which you&#39;d like to change&lt;/li&gt;
&lt;li&gt;Select the Fonts sidebar tab&lt;/li&gt;
&lt;li&gt;Use the unit drop-downs next to &lt;code&gt;Size&lt;/code&gt;, &lt;code&gt;Line Height&lt;/code&gt; or &lt;code&gt;Spacing&lt;/code&gt; to convert the current value to another unit&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/convert-font-units-1.png&quot; alt=&quot;The fonts panel in Firefox, showing the unit conversion drop-down.&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Chrome or Edge
&lt;ul&gt;
&lt;li&gt;You first need to enable the Fonts editor experiment
&lt;ul&gt;
&lt;li&gt;Go to the DevTools settings (F1)&lt;/li&gt;
&lt;li&gt;Go to the Experiments tab&lt;/li&gt;
&lt;li&gt;Check the &amp;quot;Enable the new Font Editor tool within the Styles pane&amp;quot; box&lt;/li&gt;
&lt;li&gt;Re-start DevTools&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Find an element in the Elements panel that has font properties which you&#39;d like to change&lt;/li&gt;
&lt;li&gt;Click on the &lt;code&gt;Aa&lt;/code&gt; icon in the Styles sidebar, in the CSS rule that contains the property you want to convert&lt;/li&gt;
&lt;li&gt;Use the unit drop-downs next to &lt;code&gt;Font Size&lt;/code&gt;, &lt;code&gt;Line Height&lt;/code&gt;, &lt;code&gt;Font Weight&lt;/code&gt; or &lt;code&gt;Spacing&lt;/code&gt; to convert the current value to another unit&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/convert-font-units-2.png&quot; alt=&quot;The fonts panel in Edge, showing the unit conversion drop-down.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find DevTools reference documentation</title>
    <link href="https://devtoolstips.org/tips/en/find-devtools-documentation/"/>
    <updated>2021-07-02T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-devtools-documentation/</id>
    <content type="html">&lt;p&gt;If you want to learn more about what other tools exist in a browser, or what features a given tool provides, you can find reference documentation from all the major browsers here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://firefox-source-docs.mozilla.org/devtools-user/index.html&quot;&gt;Firefox Developer Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/&quot;&gt;Edge Developer Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.chrome.com/docs/devtools/&quot;&gt;Chrome Developer Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://webkit.org/web-inspector/&quot;&gt;Safari Web Inspector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://polypane.app/docs/&quot;&gt;Polypane developer tools&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-devtools-documentation.png&quot; alt=&quot;The 4 documentation websites listed above.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Drag and drop nodes in the DOM tree</title>
    <link href="https://devtoolstips.org/tips/en/drag-drop-dom-nodes/"/>
    <updated>2021-07-01T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/drag-drop-dom-nodes/</id>
    <content type="html">&lt;p&gt;If you need to move nodes or elements around in the DOM tree, to re-order things in the page, you can do it by drag and dropping nodes around in the Elements (or Inspector) panel.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/drag-drop-dom-nodes.gif&quot; alt=&quot;Animation showing a node being dragged by the mouse in the DOM tree view of the Elements panel in Edge.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Event listeners are suppressed when paused</title>
    <link href="https://devtoolstips.org/tips/en/suppressed-event-listeners-when-paused/"/>
    <updated>2021-06-30T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/suppressed-event-listeners-when-paused/</id>
    <content type="html">&lt;p&gt;This is not really a tip, but rather an interesting thing to be aware of when debugging JavaScript.&lt;/p&gt;
&lt;p&gt;If you use breakpoints in the Sources (or Debugger) tab in DevTools to debug JavaScript, you should know that all event listeners are suppressed while paused at one of them.&lt;/p&gt;
&lt;p&gt;For example, if you have a button with an &lt;code&gt;onclick&lt;/code&gt; handler, and you&#39;re paused at a breakpoint, then clicking that button won&#39;t execute the handler. It also won&#39;t execute it later when you resume execution.&lt;br /&gt;
In fact, most DevTools display an overlay on top of the entire page that prevents you from accessing it at all.&lt;/p&gt;
&lt;p&gt;This also happens if you manually try to dispatch new events from the console using &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent&quot;&gt;&lt;code&gt;dispatchEvent&lt;/code&gt;&lt;/a&gt;. If there are handlers for these events, they also won&#39;t get called while execution is paused.&lt;/p&gt;
&lt;p&gt;The reason for this is that (ignoring workers) JavaScript on your page only runs in one thread. So while that thread is paused at one specific location, it&#39;s not supposed to be able to execute code from other locations.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/suppressed-event-listeners-when-paused.png&quot; alt=&quot;A page in edge with the DevTools Sources paused at a location, and the on-page overlay preventing access to the page.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Sample colors from the page</title>
    <link href="https://devtoolstips.org/tips/en/sample-colors-from-the-page/"/>
    <updated>2021-06-30T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/sample-colors-from-the-page/</id>
    <content type="html">&lt;p&gt;Being able to sample colors from the page is super useful. Firefox, Edge and Chrome all allow you to do this in 2 different ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox it&#39;s really simple and doesn&#39;t even require opening DevTools:
&lt;ul&gt;
&lt;li&gt;Go to the main Firefox menu&lt;/li&gt;
&lt;li&gt;Go to the &amp;quot;More Tools&amp;quot; submenu&lt;/li&gt;
&lt;li&gt;Click on the Eyedropper menu item&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/sample-colors-from-the-page-1.gif&quot; alt=&quot;Animation of the eyedropper tool being started from the Firefox main menu.&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;There is a second way to do this in Firefox from DevTools:
&lt;ul&gt;
&lt;li&gt;Open the Inspector panel&lt;/li&gt;
&lt;li&gt;Click on the eye dropper button in the typ-right corner of the panel&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/sample-colors-from-the-page-2.png&quot; alt=&quot;The eyedropper button in Firefox&#39;s inspector panel.&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Polypane you also do not need devtools&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Click the eye dropper icon in the address bar.&lt;/li&gt;
&lt;li&gt;Or use the keyboard shortcut &lt;code&gt;Shift Alt P&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After selecting a color, an overview of previously selected colors, previews and contrast ratios is shown.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/sample-colors-from-the-page-4.gif&quot; alt=&quot;Animation of starting the eyedropper tool from Polypane&#39;s address bar.&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Chrome and Edge:
&lt;ul&gt;
&lt;li&gt;Open the Elements panel and select an element that has some CSS color set to it&lt;/li&gt;
&lt;li&gt;Find the color in the Styles pane and click on the color swatch icon next to it&lt;/li&gt;
&lt;li&gt;Just start moving the mouse over the page&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/sample-colors-from-the-page-3.gif&quot; alt=&quot;Animation of starting the eyedropper tool from chrome and edge&#39;s color pickers.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Visualize the tabbing order on the page</title>
    <link href="https://devtoolstips.org/tips/en/visualize-tabbing-order/"/>
    <updated>2021-06-29T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/visualize-tabbing-order/</id>
    <content type="html">&lt;p&gt;Users who do not or can&#39;t use a mouse or trackpad can use the tab key to navigate through focusable elements on the page. If the order in which those elements get focused is incorrect, this might give users a confusing experience.&lt;/p&gt;
&lt;p&gt;In Firefox:&lt;/p&gt;
&lt;p&gt;Firefox has a dedicated &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Tools/Accessibility_inspector&quot;&gt;accessibility inspector panel&lt;/a&gt; that, among other things, lets you visualize the tabbing order on a page.&lt;/p&gt;
&lt;p&gt;This tool adds a layer on the page that shows the order in which elements would become focused.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the Accessibility panel&lt;/li&gt;
&lt;li&gt;In the toolbar, check the &amp;quot;Show Tabbing Order&amp;quot; box&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/visualize-tabbing-order.png&quot; alt=&quot;The tabbing order highlighter in Firefox, showing numbered boxes around focusable elements.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Tools/Accessibility_inspector#show_web_page_tabbing_order&quot;&gt;Learn more about it here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;p&gt;Polypane has an &lt;strong&gt;outline panel&lt;/strong&gt; that, among other things, lets you visualize the focus (tabbing) order on a page.&lt;/p&gt;
&lt;p&gt;This tool shows the tabbing order in a list that also warns you about issues with non-interactive elements, wrong tabindices and when the tab order is illogical for the current reading direction. The current active element is shown with an arrow.&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;Show overlay&lt;/strong&gt; to add a layer to the page that draws a line from each element to the next, to make it easy to follow.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/visualize-tabbing-order-polypane.png&quot; alt=&quot;The tabbing order highlighter in Polypane, showing numbered boxes and a line going from each focusable element to the next.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://polypane.app/docs/outline-panel/#focus-order-tab-order&quot;&gt;Learn more about it here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Apply CSS styles to console messages</title>
    <link href="https://devtoolstips.org/tips/en/style-console-messages/"/>
    <updated>2021-06-28T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/style-console-messages/</id>
    <content type="html">&lt;p&gt;The &lt;code&gt;console.log&lt;/code&gt; output can be styled in DevTools using CSS.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;%c Hello World&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;color: orange; font-size: 2em;&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/style-console-messages.png&quot; alt=&quot;A styled console message in Edge.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find all images without alternative text</title>
    <link href="https://devtoolstips.org/tips/en/find-all-images-without-alt-text/"/>
    <updated>2021-06-28T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-all-images-without-alt-text/</id>
    <content type="html">&lt;p&gt;With HTML, you can add alternative text to images using the &lt;code&gt;alt&lt;/code&gt; attribute. It can be used to add a text description to images, which is extremely useful for accessibility as some people may not be able to see the images. With &lt;code&gt;alt&lt;/code&gt;, screen readers can announce the alternative text to the user.&lt;/p&gt;
&lt;p&gt;Using DevTools, you can quickly check which images on a page do not have an &lt;code&gt;alt&lt;/code&gt; text, here is how:&lt;/p&gt;
&lt;p&gt;Execute this in the Console panel: &lt;code&gt;console.table($$(&#39;img&#39;).filter(i =&amp;gt; !i.alt), [&#39;src&#39;])&lt;/code&gt; and that&#39;s it! You&#39;ll have the list of image URLs that don&#39;t have an alternative text.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-all-images-without-alt-text.png&quot; alt=&quot;The output of the console.table command from above shown in the Firefox DevTools console.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Here&#39;s what this command does:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$$()&lt;/code&gt; find all elements that match a given CSS selector (&lt;a href=&quot;https://devtoolstips.org/tips/en/find-all-images-without-alt-text/query-dom-from-console.md&quot;&gt;learn more here&lt;/a&gt;). Here it is used to find all images.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;filter()&lt;/code&gt; is used to only keep the images that do not have an &lt;code&gt;alt&lt;/code&gt; attribute.&lt;/li&gt;
&lt;li&gt;Finally, &lt;code&gt;console.table()&lt;/code&gt; takes the array returned by &lt;code&gt;filter&lt;/code&gt; and outputs a pretty table in the console based on it. Notice the second (optional) paramter that is used here to retrict the number of columns to just the &lt;code&gt;src&lt;/code&gt; attribute from each image.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;In Polypane:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;outline panel&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Images&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;See which images in the list have an &amp;quot;Alt: missing!&amp;quot; warning.&lt;/li&gt;
&lt;li&gt;(Optionally) click &lt;strong&gt;Show overlay&lt;/strong&gt; to highlight the missing images on the page.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-all-images-without-alt-text-polypane.png&quot; alt=&quot;The outline panel in Polypane showing a &#39;missing&#39; warning for an image.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Draw a box around all elements to debug your CSS and page structure</title>
    <link href="https://devtoolstips.org/tips/en/outline-everything/"/>
    <updated>2021-06-25T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/outline-everything/</id>
    <content type="html">&lt;p&gt;Simple, yet powerful, &lt;code&gt;* { outline: 1px solid red; }&lt;/code&gt; is a useful debugging trick that helps understanding the page structure, finding overflow bugs or understand why elements are being pushed away for no apparent reason.&lt;/p&gt;
&lt;p&gt;In Edge, Chrome, Firefox and Safari:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the Elements panel (in Chrome, Edge or Safari) or Inspector panel (in Firefox).&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;+&lt;/code&gt; (new style) icon in the Styles or Rules sidebar.&lt;/li&gt;
&lt;li&gt;Add the rule  &lt;code&gt;{ outline: 1px solid red; }&lt;/code&gt; to the CSS Selector &lt;code&gt;*&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In Polypane:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;ctrl/cmd + d&lt;/code&gt; to automatically add outlines around all elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And voila! All elements are outlined and you can understand what&#39;s going on.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/outline-everything.gif&quot; alt=&quot;Animation showing how adding the rule in the styles pane if Chrome DevTools outlines all elements in the page.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find DOM elements from the console</title>
    <link href="https://devtoolstips.org/tips/en/query-dom-from-console/"/>
    <updated>2021-06-24T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/query-dom-from-console/</id>
    <content type="html">&lt;p&gt;&lt;code&gt;$&lt;/code&gt; and &lt;code&gt;$$&lt;/code&gt; are 2 functions you can use in the console to find elements in the page.&lt;/p&gt;
&lt;p&gt;They are essentially shortcuts to the longer &lt;code&gt;document.querySelector()&lt;/code&gt; and &lt;code&gt;document.querySelectorAll()&lt;/code&gt; functions, but &lt;code&gt;$$&lt;/code&gt; returns an array instead of a &lt;code&gt;NodeList&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;They&#39;re nice and short, and for those who worked with jQuery, they will feel familiar.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/query-dom-from-console.png&quot; alt=&quot;Firefox&#39;s console panel, showing 3 different examples of using the $ and $$ built-in console functions.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Persist console messages across page navigations and reloads</title>
    <link href="https://devtoolstips.org/tips/en/persist-logs-across-pages/"/>
    <updated>2021-06-24T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/persist-logs-across-pages/</id>
    <content type="html">&lt;p&gt;By default, the messages displayed in the console get removed as soon as you refresh the page (or navigate to a new page). If you want to keep those messages as long as DevTools is open, follow these steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox:
&lt;ul&gt;
&lt;li&gt;In the Console panel, click on the cog icon (top-right corner) and select &amp;quot;Persist Logs&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Edge or Chrome:
&lt;ul&gt;
&lt;li&gt;In the Console panel, click on the cog icon (top-right corner) and check the &amp;quot;Preserve Log&amp;quot; box&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Safari:
&lt;ul&gt;
&lt;li&gt;In the Console panel, check the &amp;quot;Preserve Log&amp;quot; box in the top toolbar&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Polypane:
&lt;ul&gt;
&lt;li&gt;In the Console panel, check the &amp;quot;Preserve&amp;quot; box in the top toolbar&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/persist-logs-across-pages.png&quot; alt=&quot;Edge devtools&#39; console showing the settings panel at the top, with the &amp;quot;perserve log&amp;quot; box checked.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Simulate color vision deficiencies</title>
    <link href="https://devtoolstips.org/tips/en/simulate-color-vision-deficiencies/"/>
    <updated>2021-06-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/simulate-color-vision-deficiencies/</id>
    <content type="html">&lt;p&gt;People who visit your web pages may have different types of color vision deficiencies that, if you incorrectly use colors for meaning, may affect their experience.&lt;/p&gt;
&lt;p&gt;Firefox, Chrome, Polypane and Edge make it possible for you to test how a web page may appear to somebody with a color vision deficiency.&lt;/p&gt;
&lt;h2 id=&quot;firefox&quot; tabindex=&quot;-1&quot;&gt;Firefox &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-color-vision-deficiencies/#firefox&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Accessibility&lt;/strong&gt; tool.&lt;/li&gt;
&lt;li&gt;In the toolbar at the top, choose from a selection of different color vision deficiencies in the &lt;strong&gt;Simulate&lt;/strong&gt; drop-down.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-color-vision-deficiencies-1.png&quot; alt=&quot;The color vision simulation drop-down in Firefox.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;chrome-and-edge&quot; tabindex=&quot;-1&quot;&gt;Chrome and Edge &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-color-vision-deficiencies/#chrome-and-edge&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Rendering&lt;/strong&gt; tool by either using the &lt;a href=&quot;https://devtoolstips.org/tips/en/simulate-color-vision-deficiencies/execute-commands.md&quot;&gt;command menu&lt;/a&gt; and type &amp;quot;rendering&amp;quot;, or by using the main menu (the &lt;strong&gt;...&lt;/strong&gt; icon in the top-right corner of the screen) and by going to &lt;strong&gt;More Tools&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Scroll down until you find the &lt;strong&gt;Emulate vision deficiencies&lt;/strong&gt; section, and choose from the drop-down.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-color-vision-deficiencies-2.png&quot; alt=&quot;The color vision simulation drop-down in Chrome.&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;polypane&quot; tabindex=&quot;-1&quot;&gt;Polypane &lt;a class=&quot;direct-link&quot; href=&quot;https://devtoolstips.org/tips/en/simulate-color-vision-deficiencies/#polypane&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Debug tools&lt;/strong&gt; option of a pane.&lt;/li&gt;
&lt;li&gt;Switch to &lt;strong&gt;Simulators&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select one of the nine available color vision simulators or hover over the &lt;strong&gt;i&lt;/strong&gt; icon for additional information.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/simulate-color-vision-deficiencies-3.png&quot; alt=&quot;The simulator drop-down in Polypane.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit CSS angles</title>
    <link href="https://devtoolstips.org/tips/en/edit-css-angles/"/>
    <updated>2021-06-22T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-css-angles/</id>
    <content type="html">&lt;p&gt;In CSS, several different properties use &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/angle&quot;&gt;angle&lt;/a&gt; unit values, such as the &lt;code&gt;rotate()&lt;/code&gt; function of a &lt;code&gt;transform&lt;/code&gt; or the &lt;code&gt;linear-gradient&lt;/code&gt; orientation of a &lt;code&gt;background-image&lt;/code&gt;, and more.&lt;/p&gt;
&lt;p&gt;In Chrome and Edge, wherever a value that uses an angle unit (e.g. &lt;code&gt;deg&lt;/code&gt;, &lt;code&gt;rad&lt;/code&gt;, &lt;code&gt;grad&lt;/code&gt;, &lt;code&gt;turn&lt;/code&gt;) is displayed in the Styles panel, you can edit it with a nice little visual editor instead of typing the number by hand.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-css-angles.gif&quot; alt=&quot;Animation of the angle editor in Chrome, where a click is made on the angle swatch, and then the mouse is used to change the angle.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit clip-path and shape-outside CSS properties by dragging points in the page</title>
    <link href="https://devtoolstips.org/tips/en/edit-clip-path-shape-outside/"/>
    <updated>2021-06-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-clip-path-shape-outside/</id>
    <content type="html">&lt;p&gt;The &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/clip-path&quot;&gt;&lt;code&gt;clip-path&lt;/code&gt; property&lt;/a&gt; is a great way to change the final shape of an element and give it the shape that you want.&lt;br /&gt;
You can use this property to make an element be a circle, an ellipse, a polygon or any shape that can be described with an &lt;a href=&quot;https://developer.mozilla.org/docs/Web/SVG/Tutorial/Paths&quot;&gt;SVG path&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/shape-outside&quot;&gt;&lt;code&gt;shape-outside&lt;/code&gt; property&lt;/a&gt; is similar in that you can define a shape, but it&#39;s useful to float other content around an element, along that shape.&lt;/p&gt;
&lt;p&gt;In Firefox, you can freely edit the polygon, circle or ellipse types of shapes with the mouse, by dragging points around in the page.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select an element that has a &lt;code&gt;clip-path&lt;/code&gt; or &lt;code&gt;shape-outside&lt;/code&gt; property applied.&lt;/li&gt;
&lt;li&gt;In the Rules sidebar (in the Inspector panel), the &lt;code&gt;clip-path&lt;/code&gt; property will have a little shape icon. Click on this icon.&lt;/li&gt;
&lt;li&gt;The shape now gets highlighted in the page, with control points.&lt;/li&gt;
&lt;li&gt;Click-and-drag any of these points to change the shape to your likings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Edit_CSS_shapes&quot;&gt;Learn more about this tool here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-clip-path-shape-outside.gif&quot; alt=&quot;Animation of the shape editor in firefox, clicking on the Rules panel icon, and then moving points around in the page.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Copy an object from the console</title>
    <link href="https://devtoolstips.org/tips/en/copy-from-console/"/>
    <updated>2021-06-21T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/copy-from-console/</id>
    <content type="html">&lt;p&gt;The console panel supports a very handy &lt;code&gt;copy()&lt;/code&gt; function that stringifies and copies anything you pass to it as an argument, so you can then paste it somewhere else.&lt;/p&gt;
&lt;p&gt;For example: &lt;code&gt;copy($$(&#39;a&#39;).map(a =&amp;gt; a.href).join(&#39;\n&#39;))&lt;/code&gt; copies all of the links from the page.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/copy-from-console.png&quot; alt=&quot;Chrome devtools&#39; console with a line of code using the copy() function.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Get the selected element in the console</title>
    <link href="https://devtoolstips.org/tips/en/get-current-element-in-console/"/>
    <updated>2021-06-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/get-current-element-in-console/</id>
    <content type="html">&lt;p&gt;If you selected an element in the Elements panel (in Chrome, Safari, Polypane or Edge) or the Inspector panel (in Firefox), you can refer to it in the console using &lt;code&gt;$0&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This shortcut will return the DOM node instance, which you can then use to do things like getting computed styles, or check DOM properties, etc.&lt;/p&gt;
&lt;p&gt;Example: &lt;code&gt;getComputedStyles($0).display&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/get-current-element-in-console.jpg&quot; alt=&quot;Safari&#39;s console showing how the $0 shortcut returns the selected element.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In Chrome, Polypane and Edge, the last 4 previously selected elements are additionally available as &lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt;, &lt;code&gt;$3&lt;/code&gt; and &lt;code&gt;$4&lt;/code&gt;. &lt;a href=&quot;https://devtoolstips.org/tips/en/get-current-element-in-console/get-current-element-in-console.md&quot;&gt;Learn more here&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Find your web component&#39;s custom element code</title>
    <link href="https://devtoolstips.org/tips/en/find-custom-elements-code/"/>
    <updated>2021-06-17T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/find-custom-elements-code/</id>
    <content type="html">&lt;p&gt;In Firefox, when inspecting elements (in the Inspector panel), you can click on the &lt;code&gt;custom&lt;/code&gt; badge to go straight to the custom element&#39;s JavaScript source code.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/find-custom-elements-code.gif&quot; alt=&quot;Animation showing the custom button in Firefox&#39;s inspector and that clicking on it goes to the debugger.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Tweak css grid and flexbox alignment properties</title>
    <link href="https://devtoolstips.org/tips/en/tweak-grid-flex-alignment/"/>
    <updated>2021-06-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/tweak-grid-flex-alignment/</id>
    <content type="html">&lt;p&gt;Chrome and Edge both have a visual editor useful for tweaking flexbox and grid alignment properties.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Head over to the Elements panel&lt;/li&gt;
&lt;li&gt;Select an element that is either a grid or flexbox container&lt;/li&gt;
&lt;li&gt;In the Styles sidebar pane, find the &lt;code&gt;display: grid&lt;/code&gt; or &lt;code&gt;display:flex&lt;/code&gt; declaration&lt;/li&gt;
&lt;li&gt;Click the little icon next to this declaration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/tweak-grid-flex-alignment.png&quot; alt=&quot;The grid editor in the Styles pane of Microsoft Edge.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>See quick accessibility information on hover</title>
    <link href="https://devtoolstips.org/tips/en/see-quick-a11y-info-on-hover/"/>
    <updated>2021-06-15T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/see-quick-a11y-info-on-hover/</id>
    <content type="html">&lt;p&gt;In Edge, Polypane and Chrome, whenever you use the element selector and hover over elements in the page, a tooltip appears with, among other things, some accessibility information about the hovered element.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To start the element selector, click on the mouse cursor icon in the top-left corner of the DevTools window.&lt;/li&gt;
&lt;li&gt;Then simply hover over elements in the page&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/see-quick-a11y-info-on-hover.gif&quot; alt=&quot;Animation of the a11y tooltip in chrome.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Filter requests in the Network panel by status code, mime type and more</title>
    <link href="https://devtoolstips.org/tips/en/filter-network-requests/"/>
    <updated>2021-06-11T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/filter-network-requests/</id>
    <content type="html">&lt;p&gt;The Network panel lets you filter requests by status code, or mime type, and more.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Click in the filter input field in the toolbar.&lt;/li&gt;
&lt;li&gt;Start typing &lt;code&gt;status-code&lt;/code&gt;, you should see an autocomplete popup letting you know of the possible accepted values. Use &lt;code&gt;status-code:404&lt;/code&gt; to find all requests that ended up in a 404 error.&lt;/li&gt;
&lt;li&gt;Other possible filters include &lt;code&gt;mime-type&lt;/code&gt;, &lt;code&gt;domain&lt;/code&gt;, &lt;code&gt;larger-than&lt;/code&gt;, &lt;code&gt;method&lt;/code&gt;, and more.&lt;/li&gt;
&lt;li&gt;You can also negate the search by putting a &lt;code&gt;-&lt;/code&gt; in front (e.g. &lt;code&gt;-status-code:404&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/filter-network-requests.png&quot; alt=&quot;The Network panel in Edge showing the filter input field.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>View performance markers in order</title>
    <link href="https://devtoolstips.org/tips/en/view-perf-markers-in-order/"/>
    <updated>2021-06-10T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/view-perf-markers-in-order/</id>
    <content type="html">&lt;p&gt;When logging &lt;code&gt;performance.timing&lt;/code&gt; events to the console, they appear in alphabetical order since they are properties of the &lt;code&gt;PerformanceTiming&lt;/code&gt; object.&lt;/p&gt;
&lt;p&gt;In order to view them in order, you can use &lt;code&gt;console.table(performance.timing)&lt;/code&gt; and click on the column heading to sort them by time.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/view-perf-markers-in-order.png&quot; alt=&quot;The console in Edge showing the PerformanceTiming object, with alphabetical properties, and then using console.table to sort properties.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Unminify JavaScript code to easily read and debug it</title>
    <link href="https://devtoolstips.org/tips/en/unminify-javascript-code/"/>
    <updated>2021-06-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/unminify-javascript-code/</id>
    <content type="html">&lt;p&gt;Sometimes, the JavaScript code that runs on a website is minified and really hard to read. This is common in production.&lt;/p&gt;
&lt;p&gt;You can unminify code in DevTools to read it more easily, and also set breakpoints.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open a file in the Sources or Debugger panel&lt;/li&gt;
&lt;li&gt;Click on the &lt;code&gt;{}&lt;/code&gt; icon at the bottom of the source code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/unminify-javascript-code.gif&quot; alt=&quot;The Sources panel in Chrome, showing the pretty-print button.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Highlight all the elements that a CSS rule matches</title>
    <link href="https://devtoolstips.org/tips/en/highlight-matching-elements/"/>
    <updated>2021-06-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/highlight-matching-elements/</id>
    <content type="html">&lt;p&gt;When you want to know which elements a given CSS rule will apply to, in addition to the currently selected element, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Firefox:
&lt;ul&gt;
&lt;li&gt;In the Style Editor panel: hover over any rule selector for some time.&lt;/li&gt;
&lt;li&gt;In the Rules panel: click on the selector icon next to any rule selector.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Chrome, Edge or Safari:
&lt;ul&gt;
&lt;li&gt;In the Styles panel: hover over any rule selector for some time.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Polypane:
&lt;ul&gt;
&lt;li&gt;In the Elements panel: Click the &lt;code&gt;[+]&lt;/code&gt; icon next to each selector.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/highlight-matching-elements.gif&quot; alt=&quot;Animation showing how hovering over selectors in chrome highlights the matching elements in the page.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Expand DOM nodes recursively</title>
    <link href="https://devtoolstips.org/tips/en/expand-nodes-recursively/"/>
    <updated>2021-06-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/expand-nodes-recursively/</id>
    <content type="html">&lt;p&gt;You can expand all descendants under a given DOM node in one go, to avoid having to expand each node one by one, which may take a while.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Chrome and Edge
&lt;ul&gt;
&lt;li&gt;Right-click on the node you want to expand and select &amp;quot;Expand recursively&amp;quot;. You can also &lt;code&gt;alt+click&lt;/code&gt; or &lt;code&gt;option+click&lt;/code&gt; on the arrow next to the node.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Firefox and Safari
&lt;ul&gt;
&lt;li&gt;Right-click on the node you want to expand and select &amp;quot;Expand All&amp;quot;. You can also &lt;code&gt;alt+click&lt;/code&gt; or &lt;code&gt;option+click&lt;/code&gt; on the arrow next to the node.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/expand-nodes-recursively.gif&quot; alt=&quot;Animation showing right-clicking on a node in Chrome&#39;s Elements panel and choosing &amp;quot;expand recursively&amp;quot;.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Edit CSS filters</title>
    <link href="https://devtoolstips.org/tips/en/edit-css-filters/"/>
    <updated>2021-06-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/edit-css-filters/</id>
    <content type="html">&lt;p&gt;The &lt;a href=&quot;https://developer.mozilla.org/docs/Web/CSS/filter&quot;&gt;&lt;code&gt;filter&lt;/code&gt;&lt;/a&gt; property in CSS lets you change the way a particular element gets rendered.&lt;/p&gt;
&lt;p&gt;Firefox provides a visual editor to play with CSS filters. You can add or remove filter functions from the list, re-order them, edit individual functions and even create presets that you can reuse later.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In the Rules panel, find an existing &lt;code&gt;filter&lt;/code&gt; property, or add a new one.&lt;/li&gt;
&lt;li&gt;Click on the filter swatch icon next to the filter value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/docs/Tools/Page_Inspector/How_to/Edit_CSS_filters&quot;&gt;Learn more on MDN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/edit-css-filters.png&quot; alt=&quot;The filter editing UI in Firefox.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Use the debugger statement to pause script execution</title>
    <link href="https://devtoolstips.org/tips/en/debugger-statement/"/>
    <updated>2021-06-08T00:00:00.000Z</updated>
    <id>https://devtoolstips.org/tips/en/debugger-statement/</id>
    <content type="html">&lt;p&gt;If you prefer to use &lt;code&gt;console.log()&lt;/code&gt; statements rather than the JavaScript debugger because you find it difficult to set breakpoints in DevTools (or you can&#39;t), then you can use the &lt;code&gt;debugger&lt;/code&gt; statement in JavaScript.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Where you normally add a &lt;code&gt;console.log()&lt;/code&gt;, add a &lt;code&gt;debugger&lt;/code&gt;, directly in the code&lt;/li&gt;
&lt;li&gt;Open DevTools on your page&lt;/li&gt;
&lt;li&gt;Trigger the action that will make your code run&lt;/li&gt;
&lt;li&gt;The Sources panel (or Debugger panel in Firefox) will automatically open up, and pause script execution at that line, giving you a chance to see what are the values of local variables, the callstack, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://devtoolstips.org/tips/assets/img/debugger-statement.png&quot; alt=&quot;The Sources panel in Edge, paused at a debugger statement.&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
</feed>
