From 91dee7d0d7cfe0f7faa2bf4b364e1db87ec6b70f Mon Sep 17 00:00:00 2001 From: bptato Date: Fri, 10 Dec 2021 16:07:54 +0100 Subject: Support inline style attributes --- src/html/parser.nim | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/html/parser.nim') 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: -- cgit 1.4.1-2-gfad0