1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[ecmascript] Call dom_html_element_get_class_name

This commit is contained in:
Witold Filipczyk 2024-06-23 20:36:20 +02:00
parent f90f52f5b4
commit 5329a84cb5
3 changed files with 13 additions and 12 deletions

View File

@ -255,7 +255,7 @@ mjs_element_get_property_className(js_State *J)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
dom_node *el = (dom_node *)(mjs_getprivate(J, 0));
dom_html_element *el = (dom_html_element *)(mjs_getprivate(J, 0));
dom_string *classstr = NULL;
dom_exception exc;
@ -263,7 +263,7 @@ mjs_element_get_property_className(js_State *J)
js_pushnull(J);
return;
}
exc = dom_element_get_attribute(el, corestring_dom_class, &classstr);
exc = dom_html_element_get_class_name(el, &classstr);
if (exc != DOM_NO_ERR) {
js_pushnull(J);
@ -1581,7 +1581,7 @@ mjs_element_set_property_className(js_State *J)
dom_exception exc;
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)js_getcontext(J);
assert(interpreter);
dom_node *el = (dom_node *)(mjs_getprivate(J, 0));
dom_html_element *el = (dom_html_element *)(mjs_getprivate(J, 0));
if (!el) {
js_pushundefined(J);
@ -1596,7 +1596,7 @@ mjs_element_set_property_className(js_State *J)
exc = dom_string_create((const uint8_t *)str, strlen(str), &classstr);
if (exc == DOM_NO_ERR && classstr) {
exc = dom_element_set_attribute(el, corestring_dom_class, classstr);
exc = dom_html_element_set_class_name(el, classstr);
interpreter->changed = 1;
dom_string_unref(classstr);
}

View File

@ -346,7 +346,7 @@ js_element_get_property_className(JSContext *ctx, JSValueConst this_val)
REF_JS(this_val);
JSValue r;
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
dom_html_element *el = (dom_html_element *)(js_getopaque(this_val, js_element_class_id));
dom_string *classstr = NULL;
dom_exception exc;
@ -354,7 +354,8 @@ js_element_get_property_className(JSContext *ctx, JSValueConst this_val)
return JS_NULL;
}
dom_node_ref(el);
exc = dom_element_get_attribute(el, corestring_dom_class, &classstr);
exc = dom_html_element_get_class_name(el, &classstr);
if (exc != DOM_NO_ERR) {
dom_node_unref(el);
@ -1691,7 +1692,7 @@ js_element_set_property_className(JSContext *ctx, JSValueConst this_val, JSValue
dom_exception exc;
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
assert(interpreter);
dom_node *el = (dom_node *)(js_getopaque(this_val, js_element_class_id));
dom_html_element *el = (dom_html_element *)(js_getopaque(this_val, js_element_class_id));
if (!el) {
return JS_UNDEFINED;
@ -1707,7 +1708,7 @@ js_element_set_property_className(JSContext *ctx, JSValueConst this_val, JSValue
exc = dom_string_create((const uint8_t *)str, len, &classstr);
if (exc == DOM_NO_ERR && classstr) {
exc = dom_element_set_attribute(el, corestring_dom_class, classstr);
exc = dom_html_element_set_class_name(el, classstr);
interpreter->changed = 1;
dom_string_unref(classstr);
}

View File

@ -584,7 +584,7 @@ element_get_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
dom_node *el = (dom_node *)JS::GetMaybePtrFromReservedSlot<dom_node>(hobj, 0);
dom_html_element *el = (dom_html_element *)JS::GetMaybePtrFromReservedSlot<dom_node>(hobj, 0);
dom_string *classstr = NULL;
dom_exception exc;
@ -592,7 +592,7 @@ element_get_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
args.rval().setNull();
return true;
}
exc = dom_element_get_attribute(el, corestring_dom_class, &classstr);
exc = dom_html_element_get_class_name(el, &classstr);
if (exc != DOM_NO_ERR) {
args.rval().setNull();
@ -2938,7 +2938,7 @@ element_set_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view = vs->doc_view;
struct document *document = doc_view->document;
dom_node *el = (dom_node *)JS::GetMaybePtrFromReservedSlot<dom_node>(hobj, 0);
dom_html_element *el = (dom_html_element *)JS::GetMaybePtrFromReservedSlot<dom_node>(hobj, 0);
if (!el) {
return true;
@ -2953,7 +2953,7 @@ element_set_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
dom_exception exc = dom_string_create((const uint8_t *)str, len, &classstr);
if (exc == DOM_NO_ERR && classstr) {
exc = dom_element_set_attribute(el, corestring_dom_class, classstr);
exc = dom_html_element_set_class_name(el, classstr);
interpreter->changed = 1;
dom_string_unref(classstr);
debug_dump_xhtml(document->dom);