1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-02-02 15:09:23 -05:00

[mujs] no js_dup and -2 index

This commit is contained in:
Witold Filipczyk 2022-08-18 21:59:29 +02:00
parent 98120c7960
commit aa3f10800e

View File

@ -95,17 +95,17 @@ mjs_forms_set_items(js_State *J)
int counter = 0; int counter = 0;
struct form_view *fv; struct form_view *fv;
js_newarray(J);
foreach (fv, vs->forms) { foreach (fv, vs->forms) {
struct form *form = find_form_by_form_view(document, fv); struct form *form = find_form_by_form_view(document, fv);
mjs_push_form_object(J, form); mjs_push_form_object(J, form);
js_dup(J); js_setindex(J, -2, counter);
js_setindex(J, 0, counter);
if (form->name && strcmp(form->name, "item") && strcmp(form->name, "namedItem")) { if (form->name && strcmp(form->name, "item") && strcmp(form->name, "namedItem")) {
js_setproperty(J, 0, form->name); mjs_push_form_object(J, form);
} else { js_setproperty(J, -2, form->name);
js_pop(J, 1);
} }
counter++; counter++;
} }