t.js"></script>

<div style="writing-mode: lr"
  data-expected="horizontal-tb"></div>
<div style="writing-mode: lr-tb"
  data-expected="horizontal-tb"></div>
<div style="writing-mode: rl"
  data-expected="horizontal-tb"></div>
<div style="writing-mode: rl-tb"
  data-expected="horizontal-tb"></div>

<div style="writing-mode: tb"
  data-expected="vertical-rl"></div>
<div style="writing-mode: tb-rl"
  data-expected="vertical-rl"></div>

<script>
Array.prototype.forEach.call(document.querySelectorAll("[data-exp