View Full Version : Dom

05-24-2004, 10:45 AM
Am I correct that DOM is just a specific way of using html, css and javascript together?

Can I use the three languages together in a way that would not qualify as DOM?


05-24-2004, 01:25 PM
The DOM (Document Object Model) is, as best as I can explain it, just a way of breaking down a HTML page into objects that Javascript and CSS can get to. It's like an API for webpages. So to answer your questions, broadly speaking: Yes, and No.

05-24-2004, 03:45 PM
Well, I would say it in this way:
- We have a document coded in HTML/XML/XHTML.
- Said document contains or links in a part, the style sheet that is written using CSS or other style sheet languages.
- We also have a script that executes code, in VBScript, JavaScript or any other DOM enabled language jacked into the browser.

HTML provides the way to attach a style sheet or a script, as well as provides events that trigger script execution not associated with script loading. However, the script has no way of interacting with the document or the style sheet natively - it needs an API to do that. And that's where the DOM comes in. It provides the script access to the document and through it the style sheet, allowing the script to affect the document, which it would not be able to do otherwise.

05-24-2004, 08:50 PM
DOM is not just for dynamic HTML and CSS - DOM is a model for traversing any XML document. SVG, for example, also has a DOM and uses DOM methods for scripting.

05-26-2004, 01:05 PM
Ooh, you speak so fine language, mazzas.

Can you explain things a little more basically, please?

Me don't know what API means or SVG and the like...

Thanks, it's all very interesting.

05-26-2004, 04:18 PM
Hello Mzungu -

API = Application Programming Interface

It is something that executable programs use to do OS (Operating System) specific functions, like creating windows and dialogs, creating dialog elements (such as edits, combo boxes, buttons etc.), and so on. If I remember correctly, there are thousands of API functions and constants in Windows; they are stored categorized in multiple DLL files (Dynamic Link Libraries) such as kernel32.dll, user32.dll, gdi32.dll, and many more. Those are all located in your SYSTEM folder on Windows... they belong to the Windows core.

Spudhead compared DOM functions to APIs.

SVG = Scalable Vector Graphics

- Rex

05-26-2004, 05:39 PM
Well, technically. The DOM is not just similar to an API, it IS an API. The DOM can be said to be a library of functions that allows an application access to modify the Document Infoset stored in memory. (The Document Infoset is the technical name for the memory structure that represents the document in the browser.)

05-27-2004, 01:40 PM
I'm reading this book primarily on javascript that also explains some things about dom and things are really starting to fall into place now. I think this is somewhat similar to what Neo experienced...

[Forgot that it would be extremely appropriate if I use one of these: :cool:]