"2obvious" <va********@hotmail.com> wrote in message
news:6e************************@posting.google.com ...
<snip>
... . Not that I doubt Martin, but it's easier to accept
statements when there's a comprehensive explanation that
follows. (The difference between knowing and understanding?
I hope you understand.)
I understand entirely, knowing why something is the case is always
better than just being told by some authority that it is the case
(especially given the number of times that understanding the mechanism
behind some assertion has exposed/suggested and exception that can be
exploited). Unfortunately time constraints make writing everyone a
detailed explanation for every question impractical (and repetitive).
I learned javascript working with the W3C DOM standard, and
document.getElementById() and document.getElementsByTagName()
are by far my most favored functions. Work is now forcing me
to embrace Netscape 4. Theoretically, if I could emulate these
functions under NN4, I could build a small, cross-browser DOM
of my own, and spare myself the hassle of having to rewrite a
bunch of logic.
<snip>
I am getting the impression that being encouraged to write W3C DOM
standard code (which is completely understandable in itself) is leading
to people fixating on DOM Core code at the expense of the HTML DOM Level
2 standard. Examining the HTML DOM Level 2 standard documentation at the
W3C shows that an HTMLDocument element has various specified properties
including a number of HTMLCollection properties; anchors, applets,
forms, images and links. None of which are deprecated and only the
images collection is subject to additional comment.
That means that, with the exception of document.embeds (as embeds are
not in HTML 4) and document.layers, the collections provided by Netscape
4 are still part of the DOM standard and can be accessed with code that
conforms to that standard.
So, for example, code that is written to use getElementById to access a
form or its contents because it is "DOM Standard" is misguided as it
will predictably fail where code that accesses a form via the
document.forms collection is in reality in _equal_ compliance [1] with
the published standards but will often also provide considerably greater
compatibility with ancient and unusual browsers.
Whiting cross-browser code that will include Netscape 4 would
concentrate on doing what can be done via Netscape 4's collection. If
something can't be done via those collections then the chances are that
Netscape 4 just can't do it at all. But the bulk of the resulting code
can still be HTML DOM Level 2 standard code and will also work on all
standards compliant browsers (along with many others). (The Netscape 4
proprietary document.layers collection being an obvious exception).
Richard.
[1] Jim Ley recently (and correctly) pointed out that the - document -
property of the global object does not feature in any W3C (or ECMA)
standard. So while - getElementById - and - forms - may both be
specified in the DOM standards prefixing either with - document. - is
relying on an unspecified browser implementation detail. Of course with
no DOM specified mechanism for accessing the document element from the
global object it is in reality impossible to write truly W3C DOM
compliant code with JavaScript (though in practice that is more a source
of humour than an imposition on script authoring).