mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[mujs] mjs_push_element -> mjs_push_node
This commit is contained in:
parent
ae57323d77
commit
2055a368e6
@ -21,6 +21,7 @@
|
||||
#include "js/mujs.h"
|
||||
#include "js/mujs/collection.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/node.h"
|
||||
|
||||
void *map_collections;
|
||||
void *map_rev_collections;
|
||||
@ -65,7 +66,7 @@ mjs_push_htmlCollection_item2(js_State *J, int idx)
|
||||
js_pushundefined(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -125,7 +126,7 @@ mjs_push_htmlCollection_namedItem2(js_State *J, const char *str)
|
||||
|
||||
if (err == DOM_NO_ERR && val) {
|
||||
if (dom_string_caseless_isequal(name, val)) {
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
dom_string_unref(val);
|
||||
dom_string_unref(name);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
@ -142,7 +143,7 @@ mjs_push_htmlCollection_namedItem2(js_State *J, const char *str)
|
||||
|
||||
if (err == DOM_NO_ERR && val) {
|
||||
if (dom_string_caseless_isequal(name, val)) {
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
dom_string_unref(val);
|
||||
dom_string_unref(name);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
@ -201,7 +202,7 @@ mjs_htmlCollection_set_items(js_State *J, void *node)
|
||||
if (err != DOM_NO_ERR || !element) {
|
||||
continue;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -219,7 +220,7 @@ mjs_htmlCollection_set_items(js_State *J, void *node)
|
||||
js_pop(J, 1);
|
||||
goto next;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "js/mujs.h"
|
||||
#include "js/mujs/collection.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/node.h"
|
||||
|
||||
static void
|
||||
mjs_htmlCollection2_get_property_length(js_State *J)
|
||||
@ -63,7 +64,7 @@ mjs_push_htmlCollection2_item2(js_State *J, int idx)
|
||||
js_pushundefined(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -123,7 +124,7 @@ mjs_push_htmlCollection2_namedItem2(js_State *J, const char *str)
|
||||
|
||||
if (err == DOM_NO_ERR && val) {
|
||||
if (dom_string_caseless_isequal(name, val)) {
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
dom_string_unref(val);
|
||||
dom_string_unref(name);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
@ -140,7 +141,7 @@ mjs_push_htmlCollection2_namedItem2(js_State *J, const char *str)
|
||||
|
||||
if (err == DOM_NO_ERR && val) {
|
||||
if (dom_string_caseless_isequal(name, val)) {
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
dom_string_unref(val);
|
||||
dom_string_unref(name);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
@ -201,7 +202,7 @@ mjs_htmlCollection2_set_items(js_State *J, void *node)
|
||||
if (err != DOM_NO_ERR || !element) {
|
||||
continue;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -219,7 +220,7 @@ mjs_htmlCollection2_set_items(js_State *J, void *node)
|
||||
js_pop(J, 1);
|
||||
goto next;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "js/mujs.h"
|
||||
#include "js/mujs/customevent.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "intl/charsets.h"
|
||||
#include "terminal/event.h"
|
||||
#include "viewer/text/vs.h"
|
||||
@ -217,7 +218,7 @@ mjs_customEvent_get_property_target(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, target);
|
||||
mjs_push_node(J, target);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "js/mujs/location.h"
|
||||
#include "js/mujs/document.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "js/mujs/nodelist.h"
|
||||
#include "js/mujs/nodelist2.h"
|
||||
#include "js/mujs/text.h"
|
||||
@ -178,7 +179,7 @@ mjs_document_get_property_body(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, body);
|
||||
mjs_push_node(J, body);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -333,7 +334,7 @@ mjs_document_get_property_currentScript(js_State *J)
|
||||
dom_string_unref(tag_name);
|
||||
|
||||
if (isScript) {
|
||||
mjs_push_element(J, elem);
|
||||
mjs_push_node(J, elem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -386,7 +387,7 @@ mjs_document_get_property_documentElement(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, root);
|
||||
mjs_push_node(J, root);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -500,7 +501,7 @@ mjs_document_get_property_head(js_State *J)
|
||||
return;
|
||||
}
|
||||
auto element = elements[0];
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#endif
|
||||
js_pushnull(J);
|
||||
}
|
||||
@ -1157,7 +1158,7 @@ mjs_document_createComment(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, comment);
|
||||
mjs_push_node(J, comment);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1219,7 +1220,7 @@ mjs_document_createElement(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1296,7 +1297,7 @@ mjs_document_getElementById(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1448,7 +1449,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, ret);
|
||||
mjs_push_node(J, ret);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "js/mujs/event.h"
|
||||
#include "js/mujs/fragment.h"
|
||||
#include "js/mujs/keyboard.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "js/mujs/nodelist.h"
|
||||
#include "js/mujs/nodelist2.h"
|
||||
#include "js/mujs/style.h"
|
||||
@ -547,7 +548,7 @@ mjs_element_get_property_firstChild(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -597,7 +598,7 @@ mjs_element_get_property_firstElementChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
dom_nodelist_unref(nodes);
|
||||
mjs_push_element(J, child);
|
||||
mjs_push_node(J, child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -719,7 +720,7 @@ mjs_element_get_property_lastChild(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, last_child);
|
||||
mjs_push_node(J, last_child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -768,7 +769,7 @@ mjs_element_get_property_lastElementChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
dom_nodelist_unref(nodes);
|
||||
mjs_push_element(J, child);
|
||||
mjs_push_node(J, child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -819,7 +820,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
exc = dom_node_get_node_type(next, &type);
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
mjs_push_element(J, next);
|
||||
mjs_push_node(J, next);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -956,7 +957,7 @@ mjs_element_get_property_nextSibling(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1062,7 +1063,7 @@ mjs_element_get_property_offsetParent(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1179,7 +1180,7 @@ mjs_element_get_property_parentElement(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1206,7 +1207,7 @@ mjs_element_get_property_parentNode(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1248,7 +1249,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
exc = dom_node_get_node_type(prev, &type);
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
mjs_push_element(J, prev);
|
||||
mjs_push_node(J, prev);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1281,7 +1282,7 @@ mjs_element_get_property_previousSibling(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -2387,7 +2388,7 @@ mjs_element_appendChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && res) {
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, res);
|
||||
mjs_push_node(J, res);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -2483,7 +2484,7 @@ mjs_element_cloneNode(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, clone);
|
||||
mjs_push_node(J, clone);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -2594,7 +2595,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, res);
|
||||
mjs_push_node(J, res);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -2952,7 +2953,7 @@ mjs_element_insertBefore(js_State *J)
|
||||
return;
|
||||
}
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, spare);
|
||||
mjs_push_node(J, spare);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -3062,7 +3063,7 @@ mjs_element_querySelector(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, ret);
|
||||
mjs_push_node(J, ret);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -3192,7 +3193,7 @@ mjs_element_removeChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && spare) {
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, spare);
|
||||
mjs_push_node(J, spare);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -3459,7 +3460,7 @@ int
|
||||
mjs_element_init(js_State *J)
|
||||
{
|
||||
#if 0
|
||||
mjs_push_element(J, NULL);
|
||||
mjs_push_node(J, NULL);
|
||||
js_defglobal(J, "Element", JS_DONTENUM);
|
||||
#endif
|
||||
return 0;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "js/mujs.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/event.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "intl/charsets.h"
|
||||
#include "terminal/event.h"
|
||||
|
||||
@ -148,7 +149,7 @@ mjs_event_get_property_target(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, target);
|
||||
mjs_push_node(J, target);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "js/mujs/event.h"
|
||||
#include "js/mujs/fragment.h"
|
||||
#include "js/mujs/keyboard.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "js/mujs/nodelist.h"
|
||||
#include "js/mujs/nodelist2.h"
|
||||
#include "js/mujs/style.h"
|
||||
@ -192,7 +193,7 @@ mjs_fragment_get_property_firstChild(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -242,7 +243,7 @@ mjs_fragment_get_property_firstElementChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
dom_nodelist_unref(nodes);
|
||||
mjs_push_element(J, child);
|
||||
mjs_push_node(J, child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -278,7 +279,7 @@ mjs_fragment_get_property_lastChild(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, last_child);
|
||||
mjs_push_node(J, last_child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -327,7 +328,7 @@ mjs_fragment_get_property_lastElementChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
dom_nodelist_unref(nodes);
|
||||
mjs_push_element(J, child);
|
||||
mjs_push_node(J, child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -379,7 +380,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
exc = dom_node_get_node_type(next, &type);
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
mjs_push_element(J, next);
|
||||
mjs_push_node(J, next);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -517,7 +518,7 @@ mjs_fragment_get_property_nextSibling(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -555,7 +556,7 @@ mjs_fragment_get_property_parentElement(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -582,7 +583,7 @@ mjs_fragment_get_property_parentNode(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -625,7 +626,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
exc = dom_node_get_node_type(prev, &type);
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
mjs_push_element(J, prev);
|
||||
mjs_push_node(J, prev);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -659,7 +660,7 @@ mjs_fragment_get_property_previousSibling(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -909,7 +910,7 @@ mjs_fragment_appendChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && res) {
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, res);
|
||||
mjs_push_node(J, res);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -940,7 +941,7 @@ mjs_fragment_cloneNode(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, clone);
|
||||
mjs_push_node(J, clone);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1092,7 +1093,7 @@ mjs_fragment_insertBefore(js_State *J)
|
||||
return;
|
||||
}
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, spare);
|
||||
mjs_push_node(J, spare);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1179,7 +1180,7 @@ mjs_fragment_querySelector(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, ret);
|
||||
mjs_push_node(J, ret);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1238,7 +1239,7 @@ mjs_fragment_removeChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && spare) {
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, spare);
|
||||
mjs_push_node(J, spare);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1353,7 +1354,7 @@ int
|
||||
mjs_fragment_init(js_State *J)
|
||||
{
|
||||
#if 0
|
||||
mjs_push_element(J, NULL);
|
||||
mjs_push_node(J, NULL);
|
||||
js_defglobal(J, "fragment", JS_DONTENUM);
|
||||
#endif
|
||||
return 0;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "js/mujs.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/keyboard.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "intl/charsets.h"
|
||||
#include "terminal/event.h"
|
||||
|
||||
@ -244,7 +245,7 @@ mjs_keyboardEvent_get_property_target(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, target);
|
||||
mjs_push_node(J, target);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "js/mujs/mapa.h"
|
||||
#include "js/mujs.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "js/mujs/nodelist.h"
|
||||
#include "js/mujs/window.h"
|
||||
|
||||
@ -46,7 +47,7 @@ mjs_push_nodeList_item2(js_State *J, int idx)
|
||||
js_pushundefined(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -90,7 +91,7 @@ mjs_nodeList_set_items(js_State *J, void *node)
|
||||
if (err != DOM_NO_ERR || !element) {
|
||||
continue;
|
||||
}
|
||||
mjs_push_element(J, element);
|
||||
mjs_push_node(J, element);
|
||||
js_setindex(J, -2, i);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "js/mujs/mapa.h"
|
||||
#include "js/mujs.h"
|
||||
#include "js/mujs/element.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "js/mujs/nodelist2.h"
|
||||
#include "js/mujs/window.h"
|
||||
|
||||
@ -47,7 +48,7 @@ mjs_push_nodeList2_item2(js_State *J, int idx)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, sn->node);
|
||||
mjs_push_node(J, sn->node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -80,7 +81,7 @@ mjs_nodeList2_set_items(js_State *J, void *nodes)
|
||||
struct selector_node *sn = NULL;
|
||||
|
||||
foreach (sn, *sni) {
|
||||
mjs_push_element(J, sn->node);
|
||||
mjs_push_node(J, sn->node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "js/mujs/event.h"
|
||||
#include "js/mujs/fragment.h"
|
||||
#include "js/mujs/keyboard.h"
|
||||
#include "js/mujs/node.h"
|
||||
#include "js/mujs/nodelist.h"
|
||||
#include "js/mujs/nodelist2.h"
|
||||
#include "js/mujs/style.h"
|
||||
@ -193,7 +194,7 @@ mjs_text_get_property_firstChild(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -243,7 +244,7 @@ mjs_text_get_property_firstElementChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
dom_nodelist_unref(nodes);
|
||||
mjs_push_element(J, child);
|
||||
mjs_push_node(J, child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -279,7 +280,7 @@ mjs_text_get_property_lastChild(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, last_child);
|
||||
mjs_push_node(J, last_child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -328,7 +329,7 @@ mjs_text_get_property_lastElementChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
dom_nodelist_unref(nodes);
|
||||
mjs_push_element(J, child);
|
||||
mjs_push_node(J, child);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -380,7 +381,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
exc = dom_node_get_node_type(next, &type);
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
mjs_push_element(J, next);
|
||||
mjs_push_node(J, next);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -518,7 +519,7 @@ mjs_text_get_property_nextSibling(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -556,7 +557,7 @@ mjs_text_get_property_parentElement(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -583,7 +584,7 @@ mjs_text_get_property_parentNode(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -626,7 +627,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
exc = dom_node_get_node_type(prev, &type);
|
||||
|
||||
if (exc == DOM_NO_ERR && type == DOM_ELEMENT_NODE) {
|
||||
mjs_push_element(J, prev);
|
||||
mjs_push_node(J, prev);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -660,13 +661,36 @@ mjs_text_get_property_previousSibling(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, node);
|
||||
mjs_push_node(J, node);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
dom_node_unref(node);
|
||||
}
|
||||
|
||||
static void
|
||||
mjs_text_get_property_tagName(js_State *J)
|
||||
{
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
dom_node *el = (dom_node *)(mjs_getprivate_text(J, 0));
|
||||
|
||||
if (!el) {
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
dom_string *tag_name = NULL;
|
||||
dom_exception exc = dom_node_get_node_name(el, &tag_name);
|
||||
|
||||
if (exc != DOM_NO_ERR || !tag_name) {
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
js_pushstring(J, dom_string_data(tag_name));
|
||||
dom_string_unref(tag_name);
|
||||
}
|
||||
|
||||
static void
|
||||
mjs_text_get_property_textContent(js_State *J)
|
||||
{
|
||||
@ -910,7 +934,7 @@ mjs_text_appendChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && res) {
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, res);
|
||||
mjs_push_node(J, res);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -941,7 +965,7 @@ mjs_text_cloneNode(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, clone);
|
||||
mjs_push_node(J, clone);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1093,7 +1117,7 @@ mjs_text_insertBefore(js_State *J)
|
||||
return;
|
||||
}
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, spare);
|
||||
mjs_push_node(J, spare);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1180,7 +1204,7 @@ mjs_text_querySelector(js_State *J)
|
||||
js_pushnull(J);
|
||||
return;
|
||||
}
|
||||
mjs_push_element(J, ret);
|
||||
mjs_push_node(J, ret);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1239,7 +1263,7 @@ mjs_text_removeChild(js_State *J)
|
||||
|
||||
if (exc == DOM_NO_ERR && spare) {
|
||||
interpreter->changed = 1;
|
||||
mjs_push_element(J, spare);
|
||||
mjs_push_node(J, spare);
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
@ -1346,6 +1370,7 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
addproperty(J, "parentNode", mjs_text_get_property_parentNode, NULL);
|
||||
//// addproperty(J, "previousElementSibling", mjs_text_get_property_previousElementSibling, NULL);
|
||||
addproperty(J, "previousSibling", mjs_text_get_property_previousSibling, NULL);
|
||||
addproperty(J, "tagName", mjs_text_get_property_tagName, NULL);
|
||||
addproperty(J, "textContent", mjs_text_get_property_textContent, mjs_text_set_property_textContent);
|
||||
}
|
||||
}
|
||||
@ -1354,7 +1379,7 @@ int
|
||||
mjs_text_init(js_State *J)
|
||||
{
|
||||
#if 0
|
||||
mjs_push_element(J, NULL);
|
||||
mjs_push_node(J, NULL);
|
||||
js_defglobal(J, "text", JS_DONTENUM);
|
||||
#endif
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user