mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[js] lang setter
This commit is contained in:
parent
70cd635ef3
commit
4270cb3125
@ -1539,10 +1539,17 @@ element_set_property_lang(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("lang", value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
element_set_property_outerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
|
25
test/ecmascript/lang.html
Normal file
25
test/ecmascript/lang.html
Normal file
@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<body>
|
||||
<a href="/home">BBB</a>
|
||||
<b id="aaaa" lang="en">bbb</b>
|
||||
<a id="blabla" href="/">
|
||||
<b>AAA</b><u id="ble" title="test">UUU</u>AAAAAAA
|
||||
</a>
|
||||
<a id="bb" href="/">BB</a>
|
||||
<script>
|
||||
function aa()
|
||||
{
|
||||
alert(document.getElementById('aaaa').lang);
|
||||
}
|
||||
|
||||
function bb()
|
||||
{
|
||||
document.getElementById('aaaa').lang = 'pl';
|
||||
return aa();
|
||||
}
|
||||
|
||||
</script>
|
||||
<button onclick="return aa()">Click me!</button>
|
||||
<button onclick="return bb()">Set lang to pl</button>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user