DOMImplementation: createDocumentType() Methode
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.
Die DOMImplementation.createDocumentType()
Methode gibt ein DocumentType
-Objekt zurück, das entweder mit DOMImplementation.createDocument
bei der Dokumenterstellung verwendet werden kann oder über Methoden wie Node.insertBefore()
oder Node.replaceChild()
in das Dokument eingefügt werden kann.
Syntax
createDocumentType(qualifiedNameStr, publicId, systemId)
Parameter
qualifiedNameStr
-
Ein String, der den qualifizierten Namen enthält, wie
svg:svg
. publicId
-
Ein String, der die
PUBLIC
-Kennung enthält. systemId
-
Ein String, der die
SYSTEM
-Kennungen enthält.
Rückgabewert
Ein DocumentType
.
Beispiele
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
Spezifikationen
Specification |
---|
DOM # ref-for-dom-domimplementation-createdocumenttype① |
Browser-Kompatibilität
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
Siehe auch
- Das
DOMImplementation
-Interface, zu dem es gehört.