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

[libdom] reparse document, when it was modified by js

This commit is contained in:
Witold Filipczyk 2023-09-24 17:56:58 +02:00
parent 78543c55ee
commit 15da44d9ea
3 changed files with 13 additions and 8 deletions

View File

@ -262,7 +262,6 @@ void
render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer)
{
static int initialised = 0;
int first = 0;
if (!initialised) {
corestrings_init();
@ -285,13 +284,12 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
&document->cp_status,
document->options.hard_assume);
document->dom = document_parse(document, buffer);
first = 1;
}
dump_xhtml(cached, document);
dump_xhtml(cached, document, 0);
}
void
dump_xhtml(struct cache_entry *cached, struct document *document)
dump_xhtml(struct cache_entry *cached, struct document *document, int parse)
{
dom_exception exc; /* returned by libdom functions */
dom_document *doc = NULL; /* document, loaded into libdom */
@ -347,9 +345,16 @@ dump_xhtml(struct cache_entry *cached, struct document *document)
//dom_node_unref(doc);
return;
}
document->text = tt.source;
dom_node_unref(root);
if (parse) {
free_document(document);
document->dom = NULL;
render_xhtml_document(cached, document, &tt);
done_string(&tt);
return;
}
document->text = tt.source;
render_html_document(cached, document, &tt);
return;
}
}

View File

@ -10,7 +10,7 @@ struct document;
struct string;
void render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer);
void dump_xhtml(struct cache_entry *cached, struct document *document);
void dump_xhtml(struct cache_entry *cached, struct document *document, int parse);
#ifdef __cplusplus
}

View File

@ -312,7 +312,7 @@ delayed_reload(void *data)
assert(rel);
reset_document(rel->document);
dump_xhtml(rel->cached, rel->document);
dump_xhtml(rel->cached, rel->document, 1);
sort_links(rel->document);
draw_formatted(rel->ses, 0);
mem_free(rel);