HTMLDOMドキュメントDoctype
例
HTMLドキュメントのDoctype名を取得します。
const doctypeObj = document.doctype.name;
定義と使用法
このdoctype
プロパティは、ドキュメントのdoctypeを(DocumentTypeオブジェクトとして)返します。
ドキュメントにDoctypeがない場合、プロパティdoctype
が返されます。null
doctype
プロパティは読み取り専用です。
プロパティは、Doctypeのdoctype.name
名前を返します。
関連項目:
構文
document.doctype
戻り値
タイプ | 説明 |
物体 | DocumentTypeオブジェクト。 |
ブラウザのサポート
document.doctype
DOMレベル1(1998)の機能です。
すべてのブラウザで完全にサポートされています。
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 9-11 | Yes | Yes | Yes | Yes |