DocumentType: replaceWith()-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 DocumentType.replaceWith()
-Methode ersetzt den Dokumenttyp durch eine Menge gegebener Knoten.
Syntax
js
replaceWith(node1)
replaceWith(node1, node2)
replaceWith(node1, node2, /* …, */ nodeN)
Parameter
node1
, …,nodeN
-
Eine Menge von Knoten, mit der der
DocumentType
ersetzt werden soll.
Rückgabewert
Keiner (undefined
).
Ausnahmen
HierarchyRequestError
DOMException
-
Ausgelöst, wenn der Knoten nicht an der angegebenen Stelle in der Hierarchie eingefügt werden kann.
Beispiele
Verwendung von replaceWith()
js
let svg_dt = document.implementation.createDocumentType(
"svg:svg",
"-//W3C//DTD SVG 1.1//EN",
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd",
);
document.doctype.replaceWith(svg_dt);
Spezifikationen
Specification |
---|
DOM # ref-for-dom-childnode-replacewith① |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
replaceWith |
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.