DEV Community

Russell Jones
Russell Jones

Posted on

1

HTML DOM ️loves Javascript! 💕 #TLA 😘

Our target: DOM. Yes, that. I don't know what it is, you don't know what it is, who gives a f---? Javascript is to be learned.

DHTML couldn't cut the mustard!

Dynamic HTML is like DOM's daddy if SGML were his mum.

And Javascript joined in for a 011 way while Netscape watched...

Anyway,

  • Document
  • Object
  • Model

It's a programming interface... or a way to make your webpages juicy with Javascript!

Horses mouth: https://www.w3.org/TR/WD-DOM/introduction.html

W3.org

We luh-luh-luv you! They gestated and nurtured the spec. They fought over bike sheds! All for us!!

DOCUMENT

  • A DOCUMENT is an HTML webpage
  • A DOCUMENT is also an XML document (but we won't talk about that right now!)

OBJECT MODEL

It's like looking under a TABLE's dress, or under a table wearing a dress...?

<table> DOM

So what?

Well, now you can contrive up a little action:

let  content  =  "";
const  myObj  =  { foo:  "bar"  };
myObj.fooBar  =  ()  =>  {
content  =  myObj.foo;
};
myObj.fooBar();

document.getElementById("app").innerHTML  =  content;
Enter fullscreen mode Exit fullscreen mode

If only you had a <div id="app"></div>...

https://codesandbox.io/s/zen-fog-u1748f?file=/index.html:105-125

Javascript looks at DOM seductively...

Kickass geocities site

Written with StackEdit.

Goodbye Ace

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs