X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/75936454cca139d0b226a95ee7a0070bc8702fdc..refs/pull/5721/head:/app/Util/HtmlDocument.php diff --git a/app/Util/HtmlDocument.php b/app/Util/HtmlDocument.php index ad5dacd82..7517955b9 100644 --- a/app/Util/HtmlDocument.php +++ b/app/Util/HtmlDocument.php @@ -6,6 +6,7 @@ use DOMDocument; use DOMElement; use DOMNode; use DOMNodeList; +use DOMText; use DOMXPath; /** @@ -81,6 +82,14 @@ class HtmlDocument return $element; } + /** + * Create a new text node within this document. + */ + public function createTextNode(string $text): DOMText + { + return $this->document->createTextNode($text); + } + /** * Get an element within the document of the given ID. */ @@ -149,19 +158,4 @@ class HtmlDocument { return $this->document->saveHTML($node); } - - /** - * Adopt the given nodes into this document. - * @param DOMNode[] $nodes - * @return DOMNode[] - */ - public function adoptNodes(array $nodes): array - { - $adopted = []; - foreach ($nodes as $node) { - $adopted[] = $this->document->importNode($node, true); - } - - return $adopted; - } }