diff --git a/src/document/renderer.cpp b/src/document/renderer.cpp index 37ef3726..a0ac6ffc 100644 --- a/src/document/renderer.cpp +++ b/src/document/renderer.cpp @@ -294,7 +294,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document) render_gemini_document(cached, document, &buffer); else #if defined(CONFIG_XML) && defined(CONFIG_ECMASCRIPT) - if (true) render_xhtml_document(cached, document, NULL); + if (get_opt_bool("ecmascript.enable", NULL)) render_xhtml_document(cached, document, NULL); else #endif render_html_document(cached, document, &buffer); diff --git a/src/document/xml/renderer2.cpp b/src/document/xml/renderer2.cpp index c3ab61e4..48dc8f01 100644 --- a/src/document/xml/renderer2.cpp +++ b/src/document/xml/renderer2.cpp @@ -302,10 +302,16 @@ walk_tree(std::map *mapa, struct string *buf, void *nod, if (textNode) { add_bytes_to_string(buf, textNode->get_content().c_str(), textNode->get_content().length()); } else { - auto element = dynamic_cast(node); + const auto cDataNode = dynamic_cast(node); - if (element) { - dump_element(mapa, buf, element); + if (cDataNode) { + add_bytes_to_string(buf, cDataNode->get_content().c_str(), cDataNode->get_content().length()); + } else { + auto element = dynamic_cast(node); + + if (element) { + dump_element(mapa, buf, element); + } } } } @@ -332,7 +338,7 @@ void render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer) { if (!document->dom) { - (void)get_convert_table(cached->head, document->options.cp, + (void)get_convert_table(cached->head ?: "", document->options.cp, document->options.assume_cp, &document->cp, &document->cp_status,