mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04: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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,15 @@ function aa()
|
|||||||
alert('ble ' + document.getElementById('ble').dir);
|
alert('ble ' + document.getElementById('ble').dir);
|
||||||
alert('bb ' + document.getElementById('bb').dir);
|
alert('bb ' + document.getElementById('bb').dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bb()
|
||||||
|
{
|
||||||
|
document.getElementById('blabla').dir = 'ltr';
|
||||||
|
alert('blabla ' + document.getElementById('blabla').dir);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<button onclick="return aa()">Click me!</button>
|
<button onclick="return aa()">Click me!</button>
|
||||||
|
<button onclick="return bb()">blabla.dir = ltr</button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user