diff options
author | bptato <nincsnevem662@gmail.com> | 2025-01-13 18:20:58 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2025-01-13 18:25:44 +0100 |
commit | c6643c3dbb22ff60579a8eed776b6badab86bb45 (patch) | |
tree | 3da742e3e3511fd7ea945b1c16b6bf4cbff8f98f /src | |
parent | 5e2fbc0137e087865863a764086b937ff12393f1 (diff) | |
download | chawan-c6643c3dbb22ff60579a8eed776b6badab86bb45.tar.gz |
dom: fix leak, HTMLOptionsCollection length getter
Fixes acid3 test 57
Diffstat (limited to 'src')
-rw-r--r-- | src/html/dom.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 9a4c1966..a78f4107 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -3121,6 +3121,7 @@ proc add(ctx: JSContext; this: HTMLOptionsCollection; element: Element; let res = ctx.toJS(parent.insertBefore(element, beforeEl)) if JS_IsException(res): return res + JS_FreeValue(ctx, res) return JS_UNDEFINED proc remove(this: HTMLOptionsCollection; i: int32) {.jsfunc.} = @@ -3128,6 +3129,9 @@ proc remove(this: HTMLOptionsCollection; i: int32) {.jsfunc.} = if element != nil: element.remove() +proc length(this: HTMLOptionsCollection): int {.jsfget.} = + return this.getLength() + proc setLength(this: HTMLOptionsCollection; n: uint32) {.jsfset: "length".} = let len = uint32(this.getLength()) if n > len: |