<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>Set and unset dir="auto"</title>
    <script type="text/javascript" src="setDir.js"></script>
    <style>
     textarea { resize: none; }
    </style>
  </head>
  <body onload="removeElements()">
    <div><input type="text" value="אבג ABC" dir="auto"></div>
    <div><span dir="auto"><span id="set0">גדה </span>אבג ABC</span></div>
    <div><textarea dir="auto">אבג ABC</textarea></div>
    <div><button dir="auto"><span id="set1">גדה </span>אבג ABC</button></div>
    <div><bdi><span id="set2">גדה </span>אבג ABC</bdi></div>
  </body>
</html>