HTML vs DOM? Let’s debug them #DevToolsTips
Key Takeaways
This video covers the basics of HTML and the Document Object Model (DOM), and how to debug them using Chrome DevTools, including inspecting and editing the DOM tree, and using console utilities API.
Full Transcript
[Music] what is the Dom and how does it relate to HTML in this episode we will explore two of the most common and confusing web development terms let's begin when you use a browser to request a web page the server returns HTML like this the HTML is a document with instructions on how the page should roughly look like the browser needs to process and pass the HTML to create a tree of objects like this each object of the tree is a note this entire tree representing the pages content is the Dom or we call it the document object model right now the Dom looks the same as the HTML but suppose that the script reference at the bottom runs this code it removes The Heading notes and adds another paragraph note to the Dom the complete Dom now looks like this the pages HTML is now different from its Dom in other words HTML represents initial page content and the Dom represents current page content when JavaScript adds removes or edits notes the Dom becomes different from the HTML in fact when building a page with a JavaScript framework you can use a very short HTML document and add all the notes from JavaScript that works the brows owser will pass it the same way to form the Dom with that let's inspect the page with death tools there are more than five ways to open death tools you can watch my previous video to learn more right click on the page and select inspect this is the elements panel on the left is the Dom tree this is where you can inspect edit and do all Dom related activities when you are interested in a particular Dom note inspect is a fast way to investigate that note with that the note is highlighted in the Dom tree furthermore as you navigate the notes Dev tools highlights the note in your page to there are three more handy commands to help you locate your note quicker you can use control or command F to search through the Dom if you find the Dom note is not currently in the viewport instead of scrolling all the way to the bottom you can click on the three Dot and select scroll into view in addition do you see the dollar hint in the D Tree you can press escape to bring out the console and type dollar Zer to view the current note you can also modify the text content on the Fly using this command to build the note in object format you can use the Dr command if you want to view your previous note in the navigation history type dollar one will get you that similarly you can right click and scroll to view from here this dollar command is part of the console utilities API go to this video to learn more useful commands like this since we touch on editing the Dom there are multiple easier ways to edit it as well this allows you to quickly experiment changes in the UI to edit the text content of a note double click on the text and start editing press enter to apply the changes similarly if you want to change the type of this node double click it enter the new type and press enter to add a new attribute like applying styles to the element you can right click select add attribute type in your attribute name and value look at that the color changed to deep Pink by the way you can use tab to navigate through the attributes for example double click on the note and press tab it will jump to the first attribute and you can edit the value on the fly if you want to add a hyperlink adding an anchor note like this doesn't work because Dev tools passes that as text right click on the note and select edit as HTML paste in your anchor and press enter easy peasy now here is a lesson known feature you can drag and drop the Dom node to move them around once you are done with your changes you can right click and take a no screenshot then send it to your designer take note though Dev tools won't save the changes you make in the Dom all changes are gone after you reload the page even if you have set up a workspace that makes sense because it's the Dom Dev to doesn't know where and how to save the changes should it be the HTML or JavaScript with workspace you should edit the actual file in the sources panel to save changes to your source code all right that's all for now to learn more about manipulating the Dom with de tools visit this link happy coding and stay tuned for the next St two tips [Music] ciao
Original Description
What is HTML? What is the DOM tree? Let's demystify them and learn how to debug them with DevTools.
Chapters:
0:00 Intro
0:15 What is HTML
0:25 What is DOM
0:43 HTML vs DOM
1:11 Manipulate the DOM with JavaScript
1:33 Inspect the DOM
2:09 Locate DOM node quicker
2:27 Use $0 to console log a DOM node
3:03 Edit the DOM
4:09 Drag and drop the DOm node
4:15 Take a node screenshot
4:22 Persist changes with workspace
Resources:
https://goo.gle/devtools-dom
https://goo.gle/devtools-workspace
https://goo.gle/devtools-console-utils
https://goo.gle/devtools-open
Questions? Tweet to us:
Jecelyn Yeen → https://goo.gle/jecfish
Chrome DevTools → https://goo.gle/chromedevtools
Catch more DevTools Tips → https://goo.gle/DevToolsTips
Subscribe to Chrome for Developers → https://goo.gle/ChromeDevs
#DevToolsTips
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Chrome for Developers · Chrome for Developers · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Polymer Performance Patterns (The Polymer Summit 2015)
Chrome for Developers
Polymer Power Tools (The Polymer Summit 2015)
Chrome for Developers
Chrome Dev Summit 2014 – Chrome Case Studies
Chrome for Developers
Web Directions Code 2015 round up
Chrome for Developers
Maintainable Code - HTTP203
Chrome for Developers
iron-ajax… wat?! -- Polycasts #26
Chrome for Developers
The Guardian - Supercharged
Chrome for Developers
ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
Chrome for Developers
#AskPolymer: Rob answers all the questions ever -- Polycasts #27
Chrome for Developers
The Future of JavaScript - HTTP203
Chrome for Developers
Data Binding 101 -- Polycasts #28
Chrome for Developers
The Guardian part 2 - Supercharged
Chrome for Developers
The Future of Web Audio: with Chris Wilson and Chris Lowis
Chrome for Developers
Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome for Developers
Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Chrome for Developers
#AskPolymer: How do you make the show? -- Polycasts #29
Chrome for Developers
Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Chrome for Developers
Binding to Objects -- Polycasts #30
Chrome for Developers
Player FM - Supercharged
Chrome for Developers
Where’s the Designer? #AskPolymer -- Polycasts #31
Chrome for Developers
Jake Beats Wikipedia - HTTP203
Chrome for Developers
Supercharged Observers! -- Polycasts #32
Chrome for Developers
Jai's Web blog - Supercharged
Chrome for Developers
Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Chrome for Developers
What about internationalization? #AskPolymer -- Polycasts #33
Chrome for Developers
Developing for Billions (Chrome Dev Summit 2015)
Chrome for Developers
Google+ Performance Improvement Comparison
Chrome for Developers
Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Chrome for Developers
Progressive Web Apps (Chrome Dev Summit 2015)
Chrome for Developers
Instant Loading with Service Workers (Chrome Dev Summit 2015)
Chrome for Developers
Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Chrome for Developers
Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Chrome for Developers
Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Chrome for Developers
Polymer - State of the Union (Chrome Dev Summit 2015)
Chrome for Developers
Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Chrome for Developers
Introduction to RAIL (Chrome Dev Summit 2015)
Chrome for Developers
DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
Chrome for Developers
RAIL in the real world (Chrome Dev Summit 2015)
Chrome for Developers
#ChromeDevSummit talks are up - W00T! -- Polycast #34
Chrome for Developers
V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
Chrome for Developers
Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Chrome for Developers
Owning your performance: RAIL (Chrome Dev Summit 2015)
Chrome for Developers
HTTP/2 101 (Chrome Dev Summit 2015)
Chrome for Developers
Leadership Panel (Chrome Dev Summit 2015)
Chrome for Developers
Build Processes, Totally Tooling Tips (S2, Ep 5)
Chrome for Developers
Accessibility (Chrome Dev Summit 2015)
Chrome for Developers
Binding to Arrays -- Polycasts #35
Chrome for Developers
HTTP2 - HTTP203
Chrome for Developers
Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome for Developers
Call For Submissions - Supercharged
Chrome for Developers
Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Chrome for Developers
Testing AJAX with Web Component Tester -- Polycasts #37
Chrome for Developers
Slack: Extended Xmas Special - Supercharged
Chrome for Developers
Browser testing with Travis & Sauce Labs -- Polycasts #38
Chrome for Developers
Optimize for production with Vulcanize -- Polycasts #39
Chrome for Developers
Highlights from Chrome Dev Summit 2015
Chrome for Developers
Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome for Developers
Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Chrome for Developers
How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
Chrome for Developers
Colors – DevTools Tonight #0 (Pilot)
Chrome for Developers
More on: HTML & CSS
View skill →Related Reads
📰
📰
📰
📰
Inside the Wayfair Frontend SDE-2 Interview: A Complete Breakdown
Medium · Programming
I Spent Two Years Maintaining a React SPA. HTMX Rebuilt It in a Week
Medium · Programming
The 5 Levels of Front End Engineering (And Where Most Developers Get Stuck)
Medium · Programming
Browser-Based PDF Editing with Vue 3 and pdf-lib
Dev.to · sunshey
Chapters (12)
Intro
0:15
What is HTML
0:25
What is DOM
0:43
HTML vs DOM
1:11
Manipulate the DOM with JavaScript
1:33
Inspect the DOM
2:09
Locate DOM node quicker
2:27
Use $0 to console log a DOM node
3:03
Edit the DOM
4:09
Drag and drop the DOm node
4:15
Take a node screenshot
4:22
Persist changes with workspace
🎓
Tutor Explanation
DeepCamp AI