1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[xml] onload

This commit is contained in:
Witold Filipczyk 2021-06-25 18:25:40 +02:00
parent e52c6fe4ea
commit 488ee2ea59
3 changed files with 16 additions and 0 deletions

View File

@ -154,6 +154,7 @@ struct html_element {
int namelen;
char *options;
void *node;
/* See document/html/parser/parse.c's element_info.linebreak
* description. */
int linebreak;

View File

@ -27,6 +27,9 @@
/* Unsafe macros */
#include "document/html/internal.h"
#ifdef CONFIG_XML
#include <libxml++/libxml++.h>
#endif
#if 0
void
@ -86,11 +89,22 @@ kill_html_stack_item(struct html_context *html_context, struct html_element *e)
if_assert_failed return;
#ifdef CONFIG_ECMASCRIPT
#ifdef CONFIG_XML
xmlpp::Element *elem = e->node;
if (elem) {
std::string onload_value = elem->get_attribute_value("onload");
if (onload_value != "") {
onload = memacpy(onload_value.c_str(), onload_value.size());
}
}
#else
/* As our another tiny l33t extension, we allow the onLoad attribute for
* any element, executing it when that element is fully loaded. */
if (e->options)
onload = get_attr_val(e->options, "onLoad",
html_context->doc_cp);
#endif
if (html_context->part
&& html_context->part->document
&& onload && *onload && *onload != '^') {

View File

@ -4630,6 +4630,7 @@ start_element_2(struct element_info2 *ei, struct source_renderer *renderer, void
html_top->name = ei->name;
html_top->namelen = ei->namelen;
html_top->options = NULL;//attr;
html_top->node = node;
html_top->linebreak = ei->linebreak;
/* If the element has an onClick handler for scripts, make it