- From: Bo Yang <struggleyb.nku@gmail.com>
- Date: Wed, 19 Aug 2009 17:45:31 +0800
- To: Olli Pettay <Olli.Pettay@helsinki.fi>
- Cc: www-dom@w3.org
On Tue, Aug 18, 2009 at 9:37 PM, Olli Pettay<Olli.Pettay@helsinki.fi> wrote: > On 8/18/09 4:14 PM, Bo Yang wrote: >> >> Hi, >> >> The Core module define the DOMImplementation interface which is >> used to bootstrap the DOM, to create Document and DocumentType. But I >> can't find a way to create a specific type of Document from that >> interface. I mean, how can I create HTMLDocument from some >> DOMImplementation? Thanks! >> >> Regards! >> Bo >> >> > > In Gecko one can do it for example this way: > var dt = > document.implementation.createDocumentType( > "html", > "-//W3C//DTD HTML 4.01//EN", > null); > var doc = document.implementation.createDocument(null, null, dt); > > This behavior is based on DOM 3 Core > "Note that based on the DocumentType given to create the document, the > implementation may instantiate specialized Document objects that support > additional features than the "Core", such as "HTML" [DOM Level 2 HTML]." > > > IIRC, not all browser engines support creating specialized document > objects based on document type. Thanks, I think this is the standard way to create a HTMLDocument, :) Regards! Bo
Received on Wednesday, 19 August 2009 09:46:13 UTC