diff options
author | bptato <nincsnevem662@gmail.com> | 2025-01-05 14:19:31 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2025-01-05 14:19:31 +0100 |
commit | 68b44345037d2aa78a69e4da560e07a9a5fe8e9c (patch) | |
tree | c8e0151c5226343de0974ca107e283930d3c277a /src | |
parent | f34d87bffdb1567fdf67bf8d828d018768eacafd (diff) | |
download | chawan-68b44345037d2aa78a69e4da560e07a9a5fe8e9c.tar.gz |
dom: add form length, fix document.getElementsByName("")
Diffstat (limited to 'src')
-rw-r--r-- | src/html/dom.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 31cf4ccf..db73c23a 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -2368,6 +2368,13 @@ func getElementById(document: Document; id: string): Element {.jsfunc.} = return nil func getElementsByName(document: Document; name: CAtom): NodeList {.jsfunc.} = + if name == document.toAtom(""): + return document.newNodeList( + func(node: Node): bool = + return false, + islive = false, + childonly = true + ) return document.newNodeList( func(node: Node): bool = return node of Element and Element(node).name == name, @@ -2912,6 +2919,9 @@ proc getter(ctx: JSContext; this: HTMLFormElement; atom: JSAtom): JSValue {.jsgetownprop.} = return ctx.getter(this.elements, atom) +func length(this: HTMLFormElement): int {.jsfget.} = + return this.elements.getLength() + # <input> func jsForm(this: HTMLInputElement): HTMLFormElement {.jsfget: "form".} = return this.form |