- From: Olli Pettay <Olli.Pettay@helsinki.fi>
- Date: Tue, 18 Aug 2009 16:37:44 +0300
- To: Bo Yang <struggleyb.nku@gmail.com>
- CC: www-dom@w3.org
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.
-Olli
Received on Tuesday, 18 August 2009 13:38:47 UTC