Re: What is the meaning of the DOM ECMAScript binding?

 --- Jesse McCarthy <mccarthy36@earthlink.net> wrote: > Neil Laurance
<neil_laurance@yahoo.co.uk> wrote on 11/9/01 6:39:04 AM:
> >Jesse,
> >I think you can rely on Navigator and Explorer to follow DOM, since they are
> >both involved in its conception. A bit of example code should illustrate how
> to
> >use the DOM API in NS, and IE:
> >
> >var myDocument = window.document;  // Document object
> 
> >I hope this explains how to use DOM. Apologies for any bugs or bad practices
> ;)
> >
> >Cheers, Neil
> 
> The problem with that, Neil, is that, as a couple of individuals have been
> good 
> enough to explain to me, there is nothing in the DOM specification that 
> indicates what the name of the object representing the 'Document' object will
> 
> be -- it could be anything.  So, as I understand it, Netscape and Microsoft
> can 
> both release browsers that are 100% DOM compliant but _do not_ provide access
> 
> to the 'Document' object with the same object name.  There is no guarantee
> that 
> the 'Document' object will be exposed as 'window.document'.  E.g. Netscape 
> could release a browser that exposes the 'Document' object as 'document' and 
> Microsoft could expose the same object as 'Microsoft'.  If my understanding
> of 
> the situation is correct, then you can see the dilemma. 
> 


Jesse, you are absolutely right. However, so long as NS and Microsoft state
which object represents Document, then I see this as a faily trivial issue, for
exampe:

getBrowserType();  // some function to determine browser type based on
navigator object

var doc;
if( browser.isNS || browser.isIE ) { doc = window.document; }
if( browser.isNeils ) { doc = neil; }

var node = doc.getElementById( 'myId' ); ......

Cheers, Neil


=====
+44 7866 462220           (mobile)
neil_laurance@yahoo.co.uk (mobile)
neil_laurance@adc.com     (work)

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Received on Friday, 9 November 2001 08:54:45 UTC