Why you need DOM?

It is not the browser that convert the HTML into DOM. The developer himself writes a HTML document in the way of DOM (Document Object Model) which enables him to use stylesheets easily, and also to sue the Javascript easily.

If you don’t follow this structure of writing HTML then you may end up in struggling for colors and adding functionality.

eg: if you have

<pre>

 1st div

 1.1 div </div> </div> </pre>

Now if you have such several things then how do you style or add some functionality to it without following this structure!!

This must be equal to writing

1st div 1.1 div 

Both of these appear same when rendered in browser, but it would become impossible for developer to style only 1.1 div part

So it is helpful for developer to write HTML in DOM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s