- From: Lauren Wood <lauren@sqwest.bc.ca>
- Date: Wed, 13 Jan 1999 18:53:24 -0800
- To: www-dom@w3.org
Terje Norderhaug wrote: > > At 1:38 PM 1/13/99, Christophe Ney wrote: > >Here is a basic question for which I don't find any answer in the specs: > > > >When calling document.createElement("P") should I expect to get > >an instance of Element, HTMLElement or HTMLParagraphElement ? > > As DOM providdes interfaces NOT class definitions, you should expect to get > back an object that can be accessed using the HTMLParagraphElement > interface. What it is an instance of is not specified. The actual class of > the returned object is implementation dependent and doesn't have to match > with the names in DOM. Not necessarily - you may also get back just the Core Element of type "P", unless you specifically a) find out whether the implementation supports the HTML DOM (hasFeature), and b) depending on the language, you may need to cast to HTMLElement or HTMLParagraphElement. This is so that implementations can manipulate documents that use the HTML tag set without having to implement the HTML DOM - the script writer misses out on the convenience functions, but does have the Core functionality. Lauren
Received on Wednesday, 13 January 1999 21:53:41 UTC