1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

[js] lang, title

This commit is contained in:
Witold Filipczyk 2021-05-09 20:12:46 +02:00
parent 05620e7d08
commit 7c26da3cc3

View File

@ -89,11 +89,11 @@ JSPropertySpec element_props[] = {
JS_PSGS("dir", element_get_property_dir, element_set_property_dir, JSPROP_ENUMERATE),
JS_PSGS("id", element_get_property_id, element_set_property_id, JSPROP_ENUMERATE),
// JS_PSGS("innerHTML", element_get_property_innerHtml, element_set_property_innerHtml, JSPROP_ENUMERATE),
// JS_PSGS("lang", element_get_property_lang, element_set_property_lang, JSPROP_ENUMERATE),
JS_PSGS("lang", element_get_property_lang, element_set_property_lang, JSPROP_ENUMERATE),
// JS_PSGS("outerHTML", element_get_property_outerHtml, element_set_property_outerHtml, JSPROP_ENUMERATE),
// JS_PSG("tagName", element_get_property_tagName, JSPROP_ENUMERATE),
// JS_PSGS("textContent", element_get_property_textContent, element_set_property_textContent, JSPROP_ENUMERATE),
// JS_PSGS("title", element_get_property_title, element_set_property_title, JSPROP_ENUMERATE),
JS_PSGS("title", element_get_property_title, element_set_property_title, JSPROP_ENUMERATE),
JS_PS_END
};
@ -283,17 +283,14 @@ element_get_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
tree<HTML::Node> *el = JS_GetPrivate(hobj);
xmlpp::Element *el = JS_GetPrivate(hobj);
if (!el) {
args.rval().setNull();
return true;
}
tree<HTML::Node>::iterator it = el->begin();
it->parseAttributes();
std::string v = it->attribute("lang").second;
std::string v = el->get_attribute_value("lang");
args.rval().setString(JS_NewStringCopyZ(ctx, v.c_str()));
return true;
@ -368,17 +365,14 @@ element_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
tree<HTML::Node> *el = JS_GetPrivate(hobj);
xmlpp::Element *el = JS_GetPrivate(hobj);
if (!el) {
args.rval().setNull();
return true;
}
tree<HTML::Node>::iterator it = el->begin();
it->parseAttributes();
std::string v = it->attribute("title").second;
std::string v = el->get_attribute_value("title");
args.rval().setString(JS_NewStringCopyZ(ctx, v.c_str()));
return true;