Document: doctype プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
doctype
は Document
インターフェイスの読み取り専用プロパティで、現在の文書に関連付けられた Document Type Declaration (DTD) を表す DocumentType
オブジェクトです。
値
DocumentType
オブジェクトです。
例
js
const doctypeObj = document.doctype;
console.log(`doctypeObj.name: ${doctypeObj.name}`);
console.log(`doctypeObj.internalSubset: ${doctypeObj.internalSubset}`);
console.log(`doctypeObj.publicId: ${doctypeObj.publicId}`);
console.log(`doctypeObj.systemId: ${doctypeObj.systemId}`);
メモ
現在の文書に関連付けられている DTD が存在しないは null
が返されます。
DOM レベル 2 では、文書型宣言の編集に対応していません。
仕様書
Specification |
---|
DOM # ref-for-dom-document-doctype① |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
doctype |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.