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\".
You can simply use the style object:
console.log(document.getElementById('baz').style.direction);
DEMO
Take note that this object of the DOM only represents the in-line styles of an element, it doesn't apply to any css style sheets.