propagating 'direction' and 'writing-mode' from the <body> element to the root <html> element

Note: this is *not* the question about propagating directionality to the 
Initial Containing Block (although it's related to that issue).

Given the document

   <!DOCTYPE html>
   <html>
   <style>
     body {
       -webkit-writing-mode:vertical-rl;
       writing-mode:tb-rl; /* for IE */
       writing-mode:vertical-rl;
     }
   </style>

   <body id="body" dir="rtl"
   </body>

   <script>
     bodyStyle =
       window.getComputedStyle(document.getElementById("body"));
     alert("Body: " + bodyStyle["direction"] + "; " +
           (bodyStyle["-webkit-writing-mode"] ||
            bodyStyle["writing-mode"]));

     docStyle =
       window.getComputedStyle(document.documentElement);
     alert("Document: " + docStyle["direction"] + "; " +
           (docStyle["-webkit-writing-mode"] ||
            docStyle["writing-mode"]));
   </script>
   </html>


I have a couple of questions:

(a) Is the "dir" attribute specified on the <body> element reflected in 
the "direction" property of its computedStyle? My testing indicates that 
Gecko and Webkit say YES, while Internet Explorer says NO.

(b) For those browsers where the "dir" attribute is reflected in the 
<body> element's computedStyle, is it also propagated from <body> 
upwards (by "reverse inheritance" of some kind) to the document element? 
Gecko says NO, while Webkit says YES.


The same questions apply to [-webkit-]writing-mode, although in this 
case Gecko support is not yet shipping.


JK

Received on Monday, 15 December 2014 16:38:00 UTC