mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[js] lang, title
This commit is contained in:
parent
05620e7d08
commit
7c26da3cc3
@ -89,11 +89,11 @@ JSPropertySpec element_props[] = {
|
|||||||
JS_PSGS("dir", element_get_property_dir, element_set_property_dir, JSPROP_ENUMERATE),
|
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("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("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_PSGS("outerHTML", element_get_property_outerHtml, element_set_property_outerHtml, JSPROP_ENUMERATE),
|
||||||
// JS_PSG("tagName", element_get_property_tagName, 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("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
|
JS_PS_END
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -283,17 +283,14 @@ element_get_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tree<HTML::Node> *el = JS_GetPrivate(hobj);
|
xmlpp::Element *el = JS_GetPrivate(hobj);
|
||||||
|
|
||||||
if (!el) {
|
if (!el) {
|
||||||
args.rval().setNull();
|
args.rval().setNull();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
tree<HTML::Node>::iterator it = el->begin();
|
std::string v = el->get_attribute_value("lang");
|
||||||
it->parseAttributes();
|
|
||||||
std::string v = it->attribute("lang").second;
|
|
||||||
|
|
||||||
args.rval().setString(JS_NewStringCopyZ(ctx, v.c_str()));
|
args.rval().setString(JS_NewStringCopyZ(ctx, v.c_str()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -368,17 +365,14 @@ element_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tree<HTML::Node> *el = JS_GetPrivate(hobj);
|
xmlpp::Element *el = JS_GetPrivate(hobj);
|
||||||
|
|
||||||
if (!el) {
|
if (!el) {
|
||||||
args.rval().setNull();
|
args.rval().setNull();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
tree<HTML::Node>::iterator it = el->begin();
|
std::string v = el->get_attribute_value("title");
|
||||||
it->parseAttributes();
|
|
||||||
std::string v = it->attribute("title").second;
|
|
||||||
|
|
||||||
args.rval().setString(JS_NewStringCopyZ(ctx, v.c_str()));
|
args.rval().setString(JS_NewStringCopyZ(ctx, v.c_str()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user