1
0
Fork 0

[document] Try to pass element_offset

This commit is contained in:
Witold Filipczyk 2022-12-20 18:03:32 +01:00
parent d08bd08171
commit 583aec98f0
3 changed files with 5 additions and 2 deletions

View File

@ -373,12 +373,12 @@ check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text)
struct cache_entry *cached = document->cached;
if (!strcmp(text, "eval")) {
if (interpreter->element_offset) {
if (interpreter->write_element_offset) {
if (interpreter->writecode.length) {
std::map<int, xmlpp::Element *> *mapa = (std::map<int, xmlpp::Element *> *)document->element_map;
if (mapa) {
auto element = (*mapa).find(interpreter->element_offset);
auto element = (*mapa).find(interpreter->write_element_offset);
if (element != (*mapa).end()) {
xmlpp::Element *el = element->second;
@ -408,6 +408,7 @@ check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text)
}
}
}
interpreter->write_element_offset = 0;
} else {
if (interpreter->writecode.length) {
fromstart:

View File

@ -110,6 +110,7 @@ struct ecmascript_interpreter {
#endif
bool changed;
int element_offset;
int write_element_offset;
};
struct ecmascript_timeout {

View File

@ -1307,6 +1307,7 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin
if (argc >= 1)
{
interpreter->write_element_offset = interpreter->element_offset;
for (unsigned int i = 0; i < argc; ++i)
{
char *str = jsval_to_string(ctx, args[i]);