mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[js] className setter
This commit is contained in:
parent
5de45a9e96
commit
7a65feb323
@ -1384,6 +1384,14 @@ element_set_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
xmlpp::Element *el = JS_GetPrivate(hobj);
|
||||
if (!el) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string value = JS_EncodeString(ctx, args[0].toString());
|
||||
el->set_attribute("class", value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,14 @@ function aa()
|
||||
{
|
||||
alert(document.getElementById('aaaa').className);
|
||||
}
|
||||
|
||||
function bb()
|
||||
{
|
||||
document.getElementById('aaaa').className = 'abc';
|
||||
alert(document.getElementsByTagName("BODY")[0].outerHTML);
|
||||
}
|
||||
</script>
|
||||
<button onclick="return aa()">Click me!</button>
|
||||
<button onclick="return bb()">Set className to abc</button>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user