diff options
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/dom.nim | 5 | ||||
-rw-r--r-- | src/html/env.nim | 3 |
2 files changed, 5 insertions, 3 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 diff --git a/src/html/env.nim b/src/html/env.nim index 0a90007f..0751d12f 100644 --- a/src/html/env.nim +++ b/src/html/env.nim @@ -236,7 +236,7 @@ proc runJSJobs*(window: Window) = let ctx = r.error ctx.writeException(window.console.err) -proc newWindow*(scripting, images: bool; selector: Selector[int]; +proc newWindow*(scripting, images, styling: bool; selector: Selector[int]; attrs: WindowAttributes; factory: CAtomFactory; navigate: proc(url: URL); loader: FileLoader; url: URL): Window = let err = newDynFileStream(stderr) @@ -246,6 +246,7 @@ proc newWindow*(scripting, images: bool; selector: Selector[int]; navigator: Navigator(), loader: loader, images: images, + styling: styling, settings: EnvironmentSettings( scripting: scripting, origin: url.origin |