| <title>page title</title> |
| <iframe id=iframe></iframe> |
| var iframe = document.getElementById('iframe'); |
| function assertDirection(label, expectedDirection, html) |
| var doc = iframe.contentDocument; |
| doc.removeChild(doc.documentElement); |
| var dir = window.testRunner ? testRunner.titleTextDirection : 'testRunner unavailable'; |
| var status = html + ' should have title direction "' + expectedDirection + '". '; |
| if (dir == expectedDirection) { |
| status += 'FAIL (got: "' + dir + '")'; |
| var div = document.createElement('div'); |
| document.body.appendChild(div); |
| assertDirection('normal doc', 'ltr', |
| '<html><title>foo</title></html>'); |
| assertDirection('title dir=rtl', 'rtl', |
| '<html><title dir=rtl>foo</title></html>'); |
| assertDirection('html dir=rtl', 'rtl', |
| '<html dir=rtl><title>foo</title></html>'); |
| assertDirection('html dir=rtl, title dir=ltr', 'ltr', |
| '<html dir=rtl><title dir=ltr>foo</title></html>'); |