DocumentType: name 属性
DocumentType 的只读属性 name 返回文档的类型。
对于人工(synthetic)创建的 DocumentType,此属性反映在 DOMImplementation.createDocumentType() 中作为参数传入的值。
对于 HTML 文档,无论源代码中的实际 doctype 是什么,浏览器都会将其设置为 html。
值
字符串。
示例
js
const docType = document.implementation.createDocumentType("html", "", "");
console.log(docType.name); // Displays `html`
规范
| 规范 |
|---|
| DOM # dom-documenttype-name |
浏览器兼容性
加载中…