DEV Community

Discussion on: Browser, DOM, JavaScript. Everything you need to know to build effective web-apps. Part two - DOM.

Collapse
dmtrshat profile image
Dmitry Shatokhin Author • Edited on

Maybe you could create a Part 2 where you a bigger deep-dive into how DOM nodes are constructed behind the scenes in the underlying C/C++ code of the web browser (e.g. the data structures used by the web browser). I feel like most people don't understand how the DOM works because they don't have a solid understanding of the fundamentals of data structures, memory allocation, etc. People just take for granted that the browser works but someone had to design the data structure for an Element node, etc.
-cubiclesocial

The way the browser works from the inside is not quite about web development.
Of course, this is very valuable knowledge, but the presence or absence of this knowledge will not affect the quality of web applications. It is enough to understand the basic concept, not what is happening under the hood.
To drive well - you don't have to know exactly how every part of the car works. There's a lot of examples.
If the developer doesn't know what's going on under the hood of the browser, that doesn't make him a bad developer. Same as if developer knows it doesn't make him a good.

Talk is cheap. Show me the code.
-Linus Torvalds

People are different, someone is interested in one thing and someone else in another.
But if it is you (or someone else) who is really interested, I will write an article about it soon.

Here's a little history behind why tags are automatically closed: Early web browsers started allowing unclosed tags and other oddities that deviated from the early Standards mostly because Internet Explorer started aggressively doing so. Microsoft saw that some developers were not closing their tags and decided to add in some logic so visitors to websites using IE wouldn't see "broken" layouts.
-cubiclesocial

Microsoft is by no means the evil corporation as you expose it.
In the mid-1990s, all browser companies planned to release each version of their HTML language with their own tag names.
HTML standardization happened in 1996, and the "W3C validated" badges appeared after 1997 and had no effect on the browser war.
IEโ€™s market leadership and the collapse of Netscape is only due to dumping, not Maicrosoftโ€™s desire to please lazy developers. The appearance of "open" Firefox did not affect the standardization of HTML, but only gave impetus to the emergence of new browsers (Opera, Google Chrome) that surpassed IE in functionality. After all, even now, with "open" browsers, the complete matching of tags and HTML attributes, unfortunately, could not be achieved.

Most people today just care if something displays correctly in the major browsers rather than being strictly Standards-compliant nor really understanding why the browser does things the way it does.
-cubiclesocial

There are many tools to help make the project cross-browser.
Again, in order to create a quality application, it's enough to know about it and take it into account during development.
I know how browsers work and how DOM is built, but the only place I have applied that knowledge is this comment. It's very useful to know, but it's not necessary.

By the way, "closing" a tag isn't really what you probably think it is.
-cubiclesocial

I assure you, I'm thinking right about closing the tags.
Historically, HTML was based on SGML, which allows you to skip tags under certain conditions.
Since the element cannot have child nodes, it is defined as empty and the final tag is forbidden (as it is not reasonable).

Thank you for your feedback โค๏ธ
Have a good day!