about summary refs log tree commit diff stats
path: root/src/html/parser.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-01-25 18:11:10 +0100
committerbptato <nincsnevem662@gmail.com>2022-01-25 18:32:02 +0100
commitdfe56d32a0664026db3f2c3d8e018670daaf66c1 (patch)
tree6d18645572c2033ab06f83a9be8bb3a02a479a9a /src/html/parser.nim
parent8fb2b9a0a505a9051bac04ab0163b20db95b86fb (diff)
downloadchawan-dfe56d32a0664026db3f2c3d8e018670daaf66c1.tar.gz
Fix stylesheet containment bug
Diffstat (limited to 'src/html/parser.nim')
-rw-r--r--src/html/parser.nim10
1 files changed, 2 insertions, 8 deletions
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)