[libxml2/fix-behavior-change-in-htmlDocContentDumpFormatOutput] Restore behavior of htmlDocContentDumpFormatOutput()




commit 054e46b097524d3808fdc0815b64e14beb2baaf9
Author: David Kilzer <ddkilzer apple com>
Date:   Sat May 14 08:48:01 2022 -0700

    Restore behavior of htmlDocContentDumpFormatOutput()
    
    Patch by J Pascoe of Apple.
    
    * HTMLtree.c:
    (htmlDocContentDumpFormatOutput):
    - Prior to commit b79ab6e6d92, xmlDoc.type was set to
      XML_HTML_DOCUMENT_NODE before dumping the HTML output, then
      restored before returning.

 HTMLtree.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/HTMLtree.c b/HTMLtree.c
index 91f4b9b5..3dd78a91 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -987,7 +987,14 @@ void
 htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
                               const char *encoding ATTRIBUTE_UNUSED,
                                int format) {
+    int type = 0;
+    if (cur) {
+        type = cur->type;
+        cur->type = XML_HTML_DOCUMENT_NODE;
+    }
     htmlNodeDumpFormatOutput(buf, cur, (xmlNodePtr) cur, NULL, format);
+    if (cur)
+        cur->type = (xmlElementType) type;
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]