about summary refs log tree commit diff stats
path: root/src/html/parser.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-12-10 16:07:54 +0100
committerbptato <nincsnevem662@gmail.com>2021-12-10 16:07:54 +0100
commit91dee7d0d7cfe0f7faa2bf4b364e1db87ec6b70f (patch)
tree3605bd1cf29e8a54f5075710e2119031ad15ef92 /src/html/parser.nim
parent458f713fd4e506df0b916bb436c2d19fc6557e02 (diff)
downloadchawan-91dee7d0d7cfe0f7faa2bf4b364e1db87ec6b70f.tar.gz
Support inline style attributes
Diffstat (limited to 'src/html/parser.nim')
-rw-r--r--src/html/parser.nim20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/html/parser.nim b/src/html/parser.nim
index 0102fe17..a3a6885d 100644
--- a/src/html/parser.nim
+++ b/src/html/parser.nim
@@ -225,11 +225,11 @@ proc processDocumentStartElement(state: var HTMLParseState, element: Element, ta
   var add = true
 
   for k, v in tag.attrs:
-    element.attributes[k] = element.newAttr(k, v)
+    element.attributes[k] = v
   
-  element.id = element.getAttrValue("id")
+  element.id = element.attr("id")
   if element.attributes.hasKey("class"):
-    for w in unicode.split(element.attributes["class"].value, Rune(' ')):
+    for w in unicode.split(element.attributes["class"], Rune(' ')):
       element.classList.add(w)
 
   case element.tagType
@@ -240,16 +240,16 @@ proc processDocumentStartElement(state: var HTMLParseState, element: Element, ta
   of TAG_STYLE:
     state.in_style = true
   of TAG_SELECT:
-    HTMLSelectElement(element).name = element.getAttrValue("name")
-    HTMLSelectElement(element).value = element.getAttrValue("value")
+    HTMLSelectElement(element).name = element.attr("name")
+    HTMLSelectElement(element).value = element.attr("value")
   of TAG_INPUT:
-    HTMLInputElement(element).value = element.getAttrValue("value")
-    HTMLInputElement(element).itype = element.getAttrValue("type").inputType()
-    HTMLInputElement(element).size = element.getAttrValue("size").inputSize()
+    HTMLInputElement(element).value = element.attr("value")
+    HTMLInputElement(element).itype = element.attr("type").inputType()
+    HTMLInputElement(element).size = element.attr("size").inputSize()
   of TAG_A:
-    HTMLAnchorElement(element).href = element.getAttrValue("href")
+    HTMLAnchorElement(element).href = element.attr("href")
   of TAG_OPTION:
-    HTMLOptionElement(element).value = element.getAttrValue("href")
+    HTMLOptionElement(element).value = element.attr("href")
   of TAG_HTML:
     add = false
   of TAG_HEAD: