From e52c6fe4ea7c91ec29a6cba064b9c70954e6e5df Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 25 Jun 2021 18:08:38 +0200 Subject: [PATCH] [js] some examples works, some don't --- src/document/xml/tags.c | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/document/xml/tags.c b/src/document/xml/tags.c index 6085b744b..e3901e9f5 100644 --- a/src/document/xml/tags.c +++ b/src/document/xml/tags.c @@ -293,6 +293,55 @@ tags_html_focusable(struct source_renderer *renderer, void *node) elformat.tabindex = (tabindex & 0x7fff) << 16; } } + + std::string string_value = el->get_attribute_value("onclick"); + char *value = NULL; + if (string_value != "") { + value = memacpy(string_value.c_str(), string_value.size()); + } + mem_free_set(&elformat.onclick, value); + + string_value = el->get_attribute_value("ondblclick"); + value = NULL; + if (string_value != "") { + value = memacpy(string_value.c_str(), string_value.size()); + } + mem_free_set(&elformat.ondblclick, value); + + string_value = el->get_attribute_value("onmouseover"); + value = NULL; + if (string_value != "") { + value = memacpy(string_value.c_str(), string_value.size()); + } + mem_free_set(&elformat.onmouseover, value); + + string_value = el->get_attribute_value("onhover"); + value = NULL; + if (string_value != "") { + value = memacpy(string_value.c_str(), string_value.size()); + } + mem_free_set(&elformat.onhover, value); + + string_value = el->get_attribute_value("onfocus"); + value = NULL; + if (string_value != "") { + value = memacpy(string_value.c_str(), string_value.size()); + } + mem_free_set(&elformat.onfocus, value); + + string_value = el->get_attribute_value("onmouseout"); + value = NULL; + if (string_value != "") { + value = memacpy(string_value.c_str(), string_value.size()); + } + mem_free_set(&elformat.onmouseout, value); + + string_value = el->get_attribute_value("onblur"); + value = NULL; + if (string_value != "") { + value = memacpy(string_value.c_str(), string_value.size()); + } + mem_free_set(&elformat.onblur, value); } void @@ -3072,6 +3121,23 @@ imported: return; } } + + auto children = node->get_children(); + auto it = children.begin(); + auto en = children.end(); + + for (; it != en; ++it) { + xmlpp::CdataNode *cdata = dynamic_cast(*it); + + if (cdata) { + std::string content = cdata->get_content(); + + if (html_context->part->document) { + add_to_string_list(&html_context->part->document->onload_snippets, content.c_str(), content.size()); + } + } + } + #if 0 /* Positive, grab the rest and interpret it. */