Document.doctype - 文書型宣言
doctypeは、Documentのプロパティです。ドキュメントの文書型宣言(DocumentType)を返します。
概要
- 名前
- doctype
- 所属
- Document
- IDL
readonly attribute DocumentType? doctype;
- 仕様書
- https://dom.spec.whatwg.org/#dom-document-doctype
説明
DocumentTypeを返す。読み取り専用なので、値を代入して変更することはできない。
デモ
Document.doctypeのデモです。
<!-- このコードは編集できます。 -->
<!DOCTYPE html>
<html>
<body>
<script>
var value = document.doctype ;
console.log( value ) ;
document.body.appendChild( new Text( value ) ) ;
</script>
</body>
</html>
サポート状況
Chrome | Firefox | Safari | Edge | IE | Opera | iOS Safari | Android |
---|---|---|---|---|---|---|---|
● | ● | ● | ● | ● | ● | ● | ● |
関連記事
- Document()
- Document()は、Documentのコンストラクタです。新しいオブジェクトを作成します。
- Document.visibilityState
- visibilityStateは、Documentのプロパティです。最上位のブラウジングコンテキストが持つドキュメントの表示状態を文字列で返します。
- Document.forms
- formsは、Documentのプロパティです。ドキュメントの全てのform要素を返します。
- Document.documentElement
- documentElementは、Documentのプロパティです。ドキュメントのルート(最上位)の要素、すなわち、html要素を返します。