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

On Mon, 15 Dec 2014 17:37:32 +0100, Jonathan Kew <jfkthame@gmail.com>  
wrote:

> 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.

https://html.spec.whatwg.org/multipage/rendering.html#bidi-rendering says  
yes.

> (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.

Blink was recently changed to match Gecko AIUI. See  
http://lists.w3.org/Archives/Public/www-style/2014Dec/0003.html

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

This doesn't have an HTML attribute so that question does not apply. :-)  
But (b) should probably be equivalent for the two properties.

-- 
Simon Pieters
Opera Software

Received on Tuesday, 16 December 2014 09:21:05 UTC