From 68e44e0e80635b00333ef2fcbb0ad937581344ba Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 27 Apr 2017 02:31:32 +0200 Subject: [PATCH] fix style initialization --- 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 index 726b5aed4..166b1c6a8 100644 --- 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