From 98120c79601832586368ecf72e92afd63e3d852c Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 18 Aug 2022 21:56:08 +0200 Subject: [PATCH] [mujs] No js_dup --- src/ecmascript/mujs/attributes.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ecmascript/mujs/attributes.cpp b/src/ecmascript/mujs/attributes.cpp index d34f1816..8d82590e 100644 --- a/src/ecmascript/mujs/attributes.cpp +++ b/src/ecmascript/mujs/attributes.cpp @@ -75,6 +75,8 @@ mjs_attributes_set_items(js_State *J, void *node) auto end = al->end(); int i = 0; + js_newarray(J); + for (;it != end; ++it, ++i) { xmlpp::Attribute *attr = *it; @@ -83,15 +85,14 @@ mjs_attributes_set_items(js_State *J, void *node) } // TODO Check it mjs_push_attr(J, attr); - js_dup(J); js_setindex(J, -2, i); xmlpp::ustring name = attr->get_name(); if (name != "" && name != "item" && name != "namedItem") { + mjs_push_attr(J, attr); js_setproperty(J, -2, name.c_str()); } - js_pop(J, 1); } }