OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>page title</title> | |
5 </head> | |
6 <body onload="runTest()"> | |
7 <iframe id="iframe"></iframe> | |
8 <script> | |
9 function runTest() { | |
10 var iframe = document.getElementById('iframe'); | |
11 | |
12 function assertDirection(label, expectedDirection, html) | |
13 { | |
14 var doc = iframe.contentDocument; | |
15 doc.open(); | |
16 doc.write(html); | |
17 doc.close(); | |
18 | |
19 // We can't know the direction of the text in the title until the first | |
20 // recalc style so trigger one here so that the titleTextDirection is | |
21 // correct. | |
22 doc.documentElement.offsetTop; | |
23 | |
24 var dir = window.testRunner ? | |
25 testRunner.titleTextDirection | |
26 : 'testRunner unavailable'; | |
27 var status = html + ' should have title direction "' + expectedDirection
+ '". '; | |
28 if (dir == expectedDirection) { | |
29 status += 'PASS'; | |
30 } else { | |
31 status += 'FAIL (got: "' + dir + '")'; | |
32 } | |
33 var div = document.createElement('div'); | |
34 div.textContent = status; | |
35 document.body.appendChild(div); | |
36 } | |
37 | |
38 if (window.testRunner) | |
39 testRunner.dumpAsText(); | |
40 | |
41 assertDirection('normal doc', 'ltr', | |
42 '<html><title>foo</title></html>'); | |
43 assertDirection('title dir=rtl', 'rtl', | |
44 '<html><title dir=rtl>foo</title></html>'); | |
45 assertDirection('html dir=rtl', 'rtl', | |
46 '<html dir=rtl><title>foo</title></html>'); | |
47 assertDirection('html dir=rtl, title dir=ltr', 'ltr', | |
48 '<html dir=rtl><title dir=ltr>foo</title></html>'); | |
49 } | |
50 </script> | |
51 </body> | |
52 </html> | |
OLD | NEW |