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 |
瀏覽器相容性
載入中…