From dfe56d32a0664026db3f2c3d8e018670daaf66c1 Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 25 Jan 2022 18:11:10 +0100 Subject: Fix stylesheet containment bug --- src/html/parser.nim | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/html/parser.nim') diff --git a/src/html/parser.nim b/src/html/parser.nim index 6f5ad937..d28be97b 100644 --- a/src/html/parser.nim +++ b/src/html/parser.nim @@ -307,12 +307,6 @@ proc processDocumentStartElement(state: var HTMLParseState, element: Element, ta case element.tagType of VoidTagTypes: processDocumentEndNode(state) - if element.tagType == TAG_LINK: - if HTMLLinkElement(element).s != nil: - let content = HTMLLinkElement(element).s.readAll() - HTMLLinkElement(element).sheet = parseStylesheet(content) - HTMLLinkElement(element).s.close() - HTMLLinkElement(element).parentElement.sheets.add(HTMLLinkElement(element).sheet) of TAG_LI: HTMLLIElement(element).applyOrdinal() #needs to know parent else: discard @@ -336,8 +330,8 @@ proc processDocumentEndElement(state: var HTMLParseState, tag: DOMParsedTag) = var str = "" for child in style.textNodes: str &= child.data - style.sheet = newStringStream(str).parseStylesheet() - style.parentElement.sheets.add(style.sheet) + let sheet = newStringStream(str).parseStylesheet() + style.parentElement.sheets.add(sheet) else: discard processDocumentEndNode(state) -- cgit 1.4.1-2-gfad0