DocumentType:name 属性
>DocumentType 的只读属性 name 返回文档的类型。
对于合成的 DocumentType,此属性将反映 DOMImplementation.createDocumentType() 参数中给出的值。
对于 HTML 文档,无论源代码中的实际 doctype 是什么,浏览器始终将其设置为 html。
值
字符串。
示例
js
const docType = document.implementation.createDocumentType("html", "", "");
console.log(docType.name); // 显示“html”
规范
| 规范 |
|---|
| DOM> # dom-documenttype-name> |