]> BookStack Code Mirror - bookstack/blobdiff - app/Util/HtmlDocument.php
Tests: Updated comment test to account for new editor usage
[bookstack] / app / Util / HtmlDocument.php
index ad5dacd82f3c23744bbf9992396fd859c822473f..7517955b9f60b2e14afbd91fddb7123fc9fb2095 100644 (file)
@@ -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;
-    }
 }