DOMImplementation: createDocumentType() メソッド
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.
DOMImplementation.createDocumentType()
メソッドは DocumentType
オブジェクトを返します。これは文書作成時に DOMImplementation.createDocument
で使用したり、Node.insertBefore()
や Node.replaceChild()
などのメソッドで文書中に置いたりすることができます。
構文
js
createDocumentType(qualifiedNameStr, publicId, systemId)
引数
qualifiedNameStr
-
修飾名の入った文字列です。例えば
svg:svg
です。 publicId
-
PUBLIC
識別子の入った文字列です。 systemId
-
SYSTEM
識別子の入った文字列です。
返値
DocumentType
です。
例
js
const dt = document.implementation.createDocumentType(
"svg:svg",
"-//W3C//DTD SVG 1.1//EN",
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd",
);
const d = document.implementation.createDocument(
"http://www.w3.org/2000/svg",
"svg:svg",
dt,
);
alert(d.doctype.publicId); // -//W3C//DTD SVG 1.1//EN
仕様書
Specification |
---|
DOM # ref-for-dom-domimplementation-createdocumenttype① |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
createDocumentType |
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.
関連情報
- 所属先の
DOMImplementation
インターフェイス