mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
[mujs] element.remove()
This commit is contained in:
parent
e6c99cfc1a
commit
a6cb50e413
@ -3027,19 +3027,29 @@ mjs_element_remove(js_State *J)
|
|||||||
#ifdef ECMASCRIPT_DEBUG
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
// TODO
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
|
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
|
||||||
xmlpp::Element *el = static_cast<xmlpp::Element *>(mjs_getprivate(J, 0));
|
dom_node *el = (dom_node *)(mjs_getprivate(J, 0));
|
||||||
|
dom_node *parent = NULL;
|
||||||
|
dom_exception exc;
|
||||||
|
|
||||||
if (!el) {
|
if (!el) {
|
||||||
js_pushundefined(J);
|
js_pushundefined(J);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xmlpp::Node::remove_node(el);
|
exc = dom_node_get_parent_node(el, &parent);
|
||||||
interpreter->changed = 1;
|
|
||||||
#endif
|
if (exc != DOM_NO_ERR || !parent) {
|
||||||
|
js_pushundefined(J);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dom_node *res = NULL;
|
||||||
|
exc = dom_node_remove_child(parent, el, &res);
|
||||||
|
dom_node_unref(parent);
|
||||||
|
|
||||||
|
if (exc == DOM_NO_ERR) {
|
||||||
|
dom_node_unref(res);
|
||||||
|
interpreter->changed = 1;
|
||||||
|
}
|
||||||
js_pushundefined(J);
|
js_pushundefined(J);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user