As web developers, one of the most frequently used tools after our editors is undoubtedly the development tool available in our browsers. In this article, we will discuss some features of Chrome Dev Tools that can be beneficial to us.
This feature, recently introduced to users, allows you to quickly demonstrate how the desired text appears in the desired section of your web applications to clients who want to make real-time text changes.
document.designMode = ’on’
You can use this feature, especially in your SPA (Single-Page Application) applications, to see how your load state appears in detail during data fetch operations. Instead of using a timeout to test your load states, you can utilize this feature. For network speed, you can use default profiles such as "Fast 3G" or "Slow 3G" to test, or you can create your own profile by specifying the download and upload speeds according to your needs.
If you want to select an element and work with it, you can simply click on the element in the Elements panel and type $0 in the console. This will provide a reference to the selected element.
Once you have obtained a reference to the element, you can use the console to trigger events and make changes to it. For example, you can interact with its properties, modify its styles, or execute functions on it.
If you are using jQuery, you can easily access jQuery functions on the element by using $($0).
Using these techniques, you can effectively inspect and manipulate elements in real-time during development.
When dealing with CSS states like hover or active, it can be useful to use this feature frequently. Without using this feature, you would need to manually trigger the targeted state each time, if possible.
console.log("%cBu yazı yeşil olacaktır.", "color:green");
console.log("%cAynı zamanda font özelliklerine de müdahale edebiliriz.","color: blue; font-size: 20px");
Additionally, when you want to print your lists or arrays to the console, you can use console.table instead of console.log.
With the concept of PWA (Progressive Web Application) in today's world, web applications are progressively approaching a native experience. With recent updates, mobile browsers can access various sensors available on devices. There is a tool available to simulate device sensors for web applications developed for mobile devices.