3 <link rel=
"help" href=
"http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-dir"/>
5 var headReadDocumentDir
= document
.dir
;
7 var headWriteDocumentDir
= document
.dir
;
11 <script src=
"../../resources/js-test.js"></script>
13 description("document.dir should reflect the 'dir' content attribute of the <html> element and should be settable in <head>.");
15 debug("Read document.dir in head");
16 shouldBeEqualToString("headReadDocumentDir", "");
19 debug("Write document.dir in head");
20 shouldBeEqualToString("headWriteDocumentDir", "rtl");
23 debug("Read document.dir in body");
24 shouldBeEqualToString("document.dir", "rtl");
27 debug("Read document.documentElement.dir in body");
28 shouldBeEqualToString("document.documentElement.dir", "rtl");
31 debug("Read document.body.dir in body");
32 shouldBeEqualToString("document.body.dir", "");
35 debug("Write document.dir in body");
37 shouldBeEqualToString("document.dir", "ltr");
40 debug("Read document.documentElement.dir in body");
41 shouldBeEqualToString("document.documentElement.dir", "ltr");
44 debug("Read document.body.dir in body");
45 shouldBeEqualToString("document.body.dir", "");
48 debug("Write non-canonical case document.dir in body");
49 shouldNotThrow("document.dir = 'RTL'");
50 shouldBeEqualToString("document.dir", "rtl");
53 debug("Write invalid document.dir in body");
54 shouldNotThrow("document.dir = 'WRONG'");
55 shouldBeEqualToString("document.dir", "");
58 debug("Write non-canonical case document.body.dir in body");
59 shouldNotThrow("document.body.dir = 'RTL'");
60 shouldBeEqualToString("document.body.dir", "rtl");
63 debug("Write invalid document.body.dir in body");
64 shouldNotThrow("document.body.dir = 'WRONG'");
65 shouldBeEqualToString("document.body.dir", "");