blob: 9e4e452b5aa65df1b9d0a73766018c9a05ddf55f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../../../resources/js-test-pre.js"></script>
<style>
.testDiv {-webkit-border-start: 5px solid green; -webkit-border-end: 5px solid red; }
</style>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="result"></div>
<div id="parentDiv">
Test that the direction of english text is left-to-right.
<div id="left-to-right" dir="auto" class="testDiv">Test test test</div>
Test that the direction of hebrew text is right-to-left.
<div id="right-to-left1" dir="auto" class="testDiv">מקור השם עברית</div>
Test that '?' does not affect the directionality.
<div id="right-to-left2" dir="auto" class="testDiv"><span>??</span>מקור השם עברית<span>??</span></div>
</div>
<script>
description('Test that directionality of an element with dir=auto set is determined by the first child text node of that element.');
var el = document.getElementById("left-to-right");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(255, 0, 0)'");
el = document.getElementById("right-to-left1");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
el = document.getElementById("right-to-left2");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('border-right-color')", "'rgb(0, 128, 0)'");
document.getElementById("parentDiv").style.display = "none";
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>