Document.implementation is a read-only property that returns a DOMImplementation object (MDN)—a factory for creating documents and document types that are not tied to the live page tree.
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use document.implementation. Start with this line.
JavaScript
document.implementation
Call
What it does
document.implementation
Primary signature.
Built into the browser. Read or assign document.implementation — no import required.
Call the factory. Pass an optional title string for the new document.
Get a full HTML skeleton. The new doc already has head and body.
Read title.newDoc.title is "My Sandbox".
Isolated tree. Changes here do not affect the visible page until you import or display them.
Example 3 — Add Content to a Sandbox Document
Create elements on the new document and append them to its body.
JavaScript
const sandbox = document.implementation.createHTMLDocument("Preview");
const p = sandbox.createElement("p");
p.textContent = "Hello from a new Document!";
sandbox.body.appendChild(p);
console.log(sandbox.body.textContent);
Create the sandbox.createHTMLDocument returns a separate Document.
Use the sandbox API. Call sandbox.createElement so the node belongs to that document.
Append to sandbox body. The live page’s document.body is unchanged.
Read the result.textContent shows the paragraph text from the in-memory document.
Compatibility
Browser Support
Document.implementation is Baseline Widely available on MDN (since July 2015). It works across modern browsers and long-supported evergreen releases.
✓ Baseline · Widely available
Document.implementation
Read-only access to DOMImplementation — factory methods for creating documents and document types.
99%Browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
implementationExcellent
Bottom line: Safe everywhere you teach DOM APIs. Prefer createHTMLDocument for sandboxes. Never rely on deprecated hasFeature() for feature detection.
Frequently Asked Questions
A DOMImplementation object associated with the current document (MDN). It provides document-independent factory methods such as createHTMLDocument and createDocumentType.
No. MDN marks Document.implementation as Baseline Widely available (since July 2015). The property itself is standard and widely supported.
No. DOMImplementation.hasFeature() is deprecated. Modern browsers always return true, so it is useless for real feature detection. Prefer checks like "fullscreenEnabled" in document.
It creates a new in-memory HTML Document with head and body already present — useful for sandboxes, templates, and tests without loading a URL.
document.doctype reads this page's DocumentType node (or null). document.implementation is a factory that can create new documents and DocumentType nodes.
No. It is a read-only accessor. You call methods on the returned DOMImplementation object; you do not replace the property.