Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / document-dir-property.html
blobfce0786e48998b2a6584204d2962ef9e66fe7cfa
1 <html>
2 <head>
3 <link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-dir"/>
4 <script>
5 var headReadDocumentDir = document.dir;
6 document.dir = "rtl";
7 var headWriteDocumentDir = document.dir;
8 </script>
9 </head>
10 <body>
11 <script src="../../resources/js-test.js"></script>
12 <script>
13 description("document.dir should reflect the 'dir' content attribute of the &lt;html&gt; element and should be settable in &lt;head&gt;.");
15 debug("Read document.dir in head");
16 shouldBeEqualToString("headReadDocumentDir", "");
17 debug("");
19 debug("Write document.dir in head");
20 shouldBeEqualToString("headWriteDocumentDir", "rtl");
21 debug("");
23 debug("Read document.dir in body");
24 shouldBeEqualToString("document.dir", "rtl");
25 debug("");
27 debug("Read document.documentElement.dir in body");
28 shouldBeEqualToString("document.documentElement.dir", "rtl");
29 debug("");
31 debug("Read document.body.dir in body");
32 shouldBeEqualToString("document.body.dir", "");
33 debug("");
35 debug("Write document.dir in body");
36 document.dir = "ltr";
37 shouldBeEqualToString("document.dir", "ltr");
38 debug("");
40 debug("Read document.documentElement.dir in body");
41 shouldBeEqualToString("document.documentElement.dir", "ltr");
42 debug("");
44 debug("Read document.body.dir in body");
45 shouldBeEqualToString("document.body.dir", "");
46 debug("");
48 debug("Write non-canonical case document.dir in body");
49 shouldNotThrow("document.dir = 'RTL'");
50 shouldBeEqualToString("document.dir", "rtl");
51 debug("");
53 debug("Write invalid document.dir in body");
54 shouldNotThrow("document.dir = 'WRONG'");
55 shouldBeEqualToString("document.dir", "");
56 debug("");
58 debug("Write non-canonical case document.body.dir in body");
59 shouldNotThrow("document.body.dir = 'RTL'");
60 shouldBeEqualToString("document.body.dir", "rtl");
61 debug("");
63 debug("Write invalid document.body.dir in body");
64 shouldNotThrow("document.body.dir = 'WRONG'");
65 shouldBeEqualToString("document.body.dir", "");
66 debug("");
67 </script>
68 </body>
69 </html>