这篇翻译不完整。请帮忙从英语翻译这篇文章

DOMImplementation.createDocument()方法创建并返回一个 XMLDocument对象.

语法

doc = document.implementation.createDocument(namespaceURI, qualifiedNameStr, documentType);

参数

namespaceURI
被创建的DOMString 文档的namespaceURI 是namespaceURI ,如果文档不属于任何namespaceURI 就为null.
qualifiedNameStr
 DOMString 是否包含要创建文档的限定名称,即可选的前缀和冒号,以及本地的根元素。
documentType 可选
文档的 DocumentType 默认为null.

例子

var doc = document.implementation.createDocument ('http://www.w3.org/1999/xhtml', 'html', null);
var body = document.createElementNS('http://www.w3.org/1999/xhtml', 'body');
body.setAttribute('id', 'abc');
doc.documentElement.appendChild(body);
alert(doc.getElementById('abc')); // [object HTMLBodyElement]

规范

规范 状态 评价
DOM
DOMImplementation.createDocument
Living Standard Modified the return type of createDocument() from Document to XMLDocument.
The third argument of createDocument(), doctype, is now optional and default to null.
Document Object Model (DOM) Level 3 Core Specification
DOMImplementation.createDocument
Obsolete No change from Document Object Model (DOM) Level 2 Core Specification
Document Object Model (DOM) Level 2 Core Specification
DOMImplementation.createDocument
Obsolete Initial definition.

浏览器支持

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support 6Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

另请参见

文档标签和贡献者

此页面的贡献者: mySoul, Cribug8080
最后编辑者: mySoul,