mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[js] dir setter
This commit is contained in:
parent
7a65feb323
commit
fc60848d64
@ -1420,6 +1420,18 @@ element_set_property_dir(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());
|
||||
|
||||
if (value == "ltr" || value == "rtl" || value == "auto") {
|
||||
el->set_attribute("dir", value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,15 @@ function aa()
|
||||
alert('ble ' + document.getElementById('ble').dir);
|
||||
alert('bb ' + document.getElementById('bb').dir);
|
||||
}
|
||||
|
||||
function bb()
|
||||
{
|
||||
document.getElementById('blabla').dir = 'ltr';
|
||||
alert('blabla ' + document.getElementById('blabla').dir);
|
||||
}
|
||||
|
||||
</script>
|
||||
<button onclick="return aa()">Click me!</button>
|
||||
<button onclick="return bb()">blabla.dir = ltr</button>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user