W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

RE: Relation between core DOM and HTML DOM

From: Miles Sabin <msabin@cromwellmedia.co.uk>
Date: Thu, 15 Oct 1998 11:16:55 +0100
Message-ID: <c=US%a=_%p=Cromwell_Media%l=ODIN-981015101655Z-22242@odin.cromwellmedia.co.uk>
To: "'Don Park'" <donpark@quake.net>, "'cowan@locke.ccil.org'" <cowan@locke.ccil.org>, "'DOM list'" <www-dom@w3.org>
Don Park wrote,

> >  Document someXMLDoc = new BasicDocument();
> >  Element xmlElement = someXMLDoc.createElement("FOO");
> >  Element htmlLikeElement = someXMLDoc.createElement("TABLE");
> >
> >  if(xmlElement instanceof HTMLElement)
> >    // always false
> >
> >  if(htmlLikeElement instanceof HTMLElement)
> >    // always false
> 
> 
> In all the interface-based designs I came across, I have 
> never seen a single design which relied on the 'absence'
> of an interface.  Exactly what advantages are there to this
> 'guaranteed' lack of interface?

<HAIRSHIRT scratchiness="extreme">

Oops ... well, it was the end of a long day ...

What I *ought* to have written was,

  Document someXMLDoc = new BasicDocument();
  Element xmlElement = someXMLDoc.createElement("FOO");
  Element htmlLikeElement = someXMLDoc.createElement("TABLE");

  if(xmlElement instanceof HTMLElement)
    // possibly false (ie. implementation dependent)
  if(htmlLikeElement instanceof HTMLElement)
    // possibly false (ie. implementation dependent)

In defence the best I can say is that if you can't guarantee
that an interface *is* supported you'd be well advised to
assume that it *isn't* ... unless you want to get embroiled
in lots of hard to maintain switches on type. That's a bit
lame tho' ... mea culpa ...

</HAIRSHIRT>

Cheers,


Miles

-- 
Miles Sabin                          Cromwell Media
Internet Systems Architect           5/6 Glenthorne Mews
+44 (0)181 410 2230                  London, W6 0LJ
msabin@cromwellmedia.co.uk           England
Received on Thursday, 15 October 1998 06:22:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:45 GMT