commit 68e44e0e80635b00333ef2fcbb0ad937581344ba parent 3c563c78d47318ca65d3cc41c50b8d665635fcf7 Author: Florian Dold <florian.dold@gmail.com> Date: Thu, 27 Apr 2017 02:31:32 +0200 fix style initialization Diffstat:
| M | src/content_scripts/notify.ts | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/content_scripts/notify.ts b/src/content_scripts/notify.ts @@ -257,8 +257,15 @@ function init() { return; } if (document.documentElement.getAttribute("data-taler-nojs")) { - initStyle(); - setStyles(true); + const onload = () => { + initStyle(); + setStyles(true); + }; + if (document.readyState == "complete") { + onload(); + } else { + document.addEventListener("DOMContentLoaded", onload); + } } registerHandlers(); // Hack to know when the extension is unloaded