From 1ded89969b2d6f5253a998309833e248571077dc Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 9 Apr 2017 08:10:25 +0300 Subject: [PATCH] localization: don't recheck on DOMContentLoaded --- localization.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/localization.js b/localization.js index ca423777..47a2ca16 100644 --- a/localization.js +++ b/localization.js @@ -73,14 +73,15 @@ function tDocLoader() { tNodeList(document.all); // localize BODY - const observer = new MutationObserver(mutations => { + const process = mutations => { for (const mutation of mutations) { tNodeList(mutation.addedNodes); } - }); + }; + const observer = new MutationObserver(process); const onLoad = () => { tDocLoader.stop(); - tNodeList(document.all); + process(observer.takeRecords()); }; tDocLoader.start = () => { observer.observe(document, {subtree: true, childList: true});