From ae82d42318bc25bf5546b63b70389529e2b83cb8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 24 Jul 2024 21:02:16 +0200 Subject: [PATCH] [quickjs] element.appendChild and cloneNode --- src/ecmascript/quickjs/element.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ecmascript/quickjs/element.c b/src/ecmascript/quickjs/element.c index 7023e709e..413e2cf4d 100644 --- a/src/ecmascript/quickjs/element.c +++ b/src/ecmascript/quickjs/element.c @@ -2459,8 +2459,10 @@ js_element_appendChild(JSContext *ctx, JSValueConst this_val, int argc, JSValueC if (exc == DOM_NO_ERR && res) { interpreter->changed = 1; //dom_node_unref(el); + JSValue rr = getElement(ctx, res); + dom_node_unref(res); - return getElement(ctx, res); + return rr; } //dom_node_unref(el); @@ -2567,8 +2569,10 @@ js_element_cloneNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueCon return JS_NULL; } //dom_node_unref(el); + JSValue rr = getElement(ctx, clone); + dom_node_unref(clone); - return getElement(ctx, clone); + return rr; } #if 0