Continuing javascript execution after total DOM body replacement using DOM mutation observers

Martin Paul Eve · 2016

As part of the translation platform we're building, I needed to implement the following workflow: If the DOM has been modified previously, then restore the DOM and run the substitution function. If the DOM hasn't been modified, then just run the substitution function. The problem was that whenever I ran $("body").html(this.original_document); in the first of these cases, the javascript would stop executing.

Read the paper · More papers on PaperTik