What\'s the best way to detect the text direction of an html element using Javascript? I would expect to get either \"rtl\" or \"ltr\".
getComputedStyle is available in modern browsers (IE9+ and the others).
getComputedStyle
getComputedStyle(document.getElementById('foo')).direction
http://jsfiddle.net/m8Zwk/
Reference to getComputedStyle on Mozilla Developer Network