From 1970a744ef186ae136e63d534314bc45a9a4f621 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 6 May 2020 01:04:31 +0200 Subject: styles: Fix `stylesheet` is `null` error I had initialised the `stylesheet` variable before the element existed in the DOM. --- src/styles.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/styles.ts b/src/styles.ts index a9997cf..940ff30 100644 --- a/src/styles.ts +++ b/src/styles.ts @@ -1,9 +1,10 @@ export function styles () { var style = document.createElement('style'); - var stylesheet = style.sheet as CSSStyleSheet; document.head.appendChild(style); + var stylesheet = style.sheet as CSSStyleSheet; + stylesheet.insertRule( '.OriginalsPostPlay-BackgroundTrailer .BackToBrowse { visibility: hidden; }', stylesheet.cssRules.length -- cgit v1.2.3