DocumentType:name 属性
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
DocumentType 的只读属性 name 返回文档的类型。
对于合成的 DocumentType,此属性将反映 DOMImplementation.createDocumentType() 参数中给出的值。
对于 HTML 文档,无论源代码中的实际 doctype 是什么,浏览器始终将其设置为 html。
值
字符串。
示例
js
const docType = document.implementation.createDocumentType("html", "", "");
console.log(docType.name); // 显示“html”
规范
| Specification |
|---|
| DOM> # dom-documenttype-name> |
浏览器兼容性
Loading…