todo app: more features
This commit is contained in:
parent
8da1ac07c0
commit
44c7015a26
5 changed files with 90 additions and 36 deletions
10
vdom.nim
10
vdom.nim
|
|
@ -9,12 +9,12 @@ type
|
|||
tdiv,
|
||||
table, tr, td, th, thead, tbody,
|
||||
link, span, label, br, select, option,
|
||||
fieldset, input
|
||||
fieldset, input, button
|
||||
|
||||
const
|
||||
toTag*: array[VNodeKind, cstring] = [
|
||||
cstring"#text", "A", "DIV", "TABLE", "TR", "TD", "TH", "THEAD", "TBODY", "LINK",
|
||||
"SPAN", "LABEL", "BR", "SELECT", "OPTION", "FIELDSET", "INPUT"
|
||||
"SPAN", "LABEL", "BR", "SELECT", "OPTION", "FIELDSET", "INPUT", "BUTTON"
|
||||
]
|
||||
|
||||
type
|
||||
|
|
@ -93,6 +93,12 @@ iterator attrs*(n: VNode): (cstring, cstring) =
|
|||
for i in countup(0, n.attrs.len-2, 2):
|
||||
yield (n.attrs[i], n.attrs[i+1])
|
||||
|
||||
proc sameAttrs*(a, b: VNode): bool =
|
||||
if a.attrs.len == b.attrs.len:
|
||||
result = true
|
||||
for i in 0 ..< a.attrs.len:
|
||||
if a.attrs[i] != b.attrs[i]: return false
|
||||
|
||||
proc addEventListener*(n: VNode; event: EventKind; handler: EventHandler) =
|
||||
n.events.add((event, handler))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue