Skip to content

Commit

Permalink
[document] Try to pass element_offset
Browse files Browse the repository at this point in the history
  • Loading branch information
rkd77 committed Dec 20, 2022
1 parent d08bd08 commit 583aec9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ecmascript/ecmascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/ecmascript/ecmascript.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ struct ecmascript_interpreter {
#endif
bool changed;
int element_offset;
int write_element_offset;
};

struct ecmascript_timeout {
Expand Down
1 change: 1 addition & 0 deletions src/ecmascript/spidermonkey/document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 583aec9

Please sign in to comment.