about summary refs log tree commit diff stats
path: root/src/html/dom.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/html/dom.nim')
-rw-r--r--src/html/dom.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 503bdf27..bb5128dc 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -87,6 +87,7 @@ type
     factory*: CAtomFactory
     loadingResourcePromises*: seq[EmptyPromise]
     images*: bool
+    styling*: bool
     # ID of the next image
     imageId: int
 
@@ -2245,7 +2246,7 @@ func referrerpolicy(element: HTMLScriptElement): Option[ReferrerPolicy] =
   return strictParseEnum[ReferrerPolicy](element.attr(satReferrerpolicy))
 
 proc sheets*(document: Document): seq[CSSStylesheet] =
-  if document.cachedSheetsInvalid:
+  if document.cachedSheetsInvalid and document.window.styling:
     document.cachedSheets.setLen(0)
     for elem in document.html.descendants:
       if elem of HTMLStyleElement:
@@ -2860,7 +2861,7 @@ var appliesFwdDecl*: proc(mqlist: MediaQueryList; window: Window): bool
 # see https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet
 #TODO make this somewhat compliant with ^this
 proc loadResource(window: Window; link: HTMLLinkElement) =
-  if satStylesheet notin link.relList:
+  if not window.styling or satStylesheet notin link.relList:
     return
   if link.fetchStarted:
     return