<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../../../resources/js-test-pre.js"></script>
<style>
.testElement {border-inline-start: 5px solid green; border-inline-end: 5px solid red; }
</style>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="result"></div>

<div id="parentDiv">
<input type="text" id="text1" dir="auto" class="testElement" value="מקור השם עברית">
<textarea id="text2" dir="auto" class="testElement">מקור השם עברית</textarea>
</div>
<script>

description('Test that directionality is re-evaluated when dir attribute changes.');

var el = document.getElementById("text1");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
el.setAttribute("dir", "ltr");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");

el = document.getElementById("text2");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
el.setAttribute("dir", "ltr");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");

el = document.getElementById("parentDiv");
el.style.display = "none";
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
