[thelist] How do I know if a piece of JS is DOM or browser specific?

Peter-Paul Koch gassinaumasis at hotmail.com
Tue Oct 15 04:34:01 CDT 2002

>I'm trying to learn how to play with the DOM, but I want to avoid any
>browser specific stuff and code "W3C" DOM.

For the moment you cannot ignore browser specific stuff, or your sites won't
work in Netscape and Explorer 4.

>The trick is that I don't know any Javascript/EMCAscript.  I mean
>none... I haven't even played with anything beyond 'window.open'... and
>then I thought to myself "Is 'window.open' what I should be using, or is
>there an alternative, W3C/DOM way?"

The W3C has only standardized a DOM for XML documents (and since HTML
documents are XML documents, it also works on HTML). However, window.open is
a quite different part of JavaScript, properly speaking it isn't part of the
DOM since it's not about documents but about browser windows.

See http://www.digital-web.com/features/feature_2001-5.shtml for an
introduction to the three DOM levels. No coding examples, just a story about
the Why of DOMs.

>Is there a list somewhere of the W3C allowable .... methods (or whatever
>the right word is for things like 'window.open')?

http://www.xs4all.nl/~ppk/js/index.html?version5.html gives the browser
compatibility list. Again, this is only about the W3C DOM, not about simpler
stuff like window.open or document.forms

>I know how to tell if I am writing valid XHTML, and I know how to tell if I
>am writing valid CSS, but how do I know if I am writing valid W3C DOM

If they work in all browsers they're valid. There is no validator or such
for JavaScript, thank God.

>ps -- there seem to be a lot of books coming out for XHTML and CSS
>standards, but are there any out there for writing 'strict' DOM scripts?
>  is there a beginner's DOM/JS list out there somewhere I should be
>joining so I can annoy them instead of you?

I think you should start with a simple JavaScript book. First get the
basics, don't worry too much about the DOM. Then, when you can write simple
scripts, go on to more complex things like DHTML, and only then tackle the


Chat with friends online, try MSN Messenger: http://messenger.msn.com

More information about the thelist mailing list