tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

568.html (1470B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      5    <title>A &lt;div&gt; with role "button" followed by removal of the element and its children and an insertion of a new div having role="checkbox"</title>
      6    <script>
      7      function changeRoleByRemoval (/* Element */ element, /* String */ newRole) {
      8          var parent = element.parentNode;
      9          if (parent) {
     10              parent.removeChild (element);
     11              var div = document.createElement ('div');
     12              div.setAttribute ('role', newRole);
     13              div.setAttribute ('id', 'test');
     14              div.setAttribute ('tabindex', '0');
     15              div.setAttribute ('onclick', 'changeRoleByRemoval (this, "checkbox");');
     16              div.setAttribute ('onkeydown', 'changeRoleByRemoval (this, "checkbox");');
     17              div.innerHTML = "This &lt;div&gt; has role '" + newRole + "'";
     18              parent.appendChild (div);
     19          }
     20      }
     21  </script>
     22  </head>
     23  <body>
     24    <div>
     25    <div role="button" id="test" tabindex="0" onclick="changeRoleByRemoval (this, 'checkbox');" onkeydown="changeRoleByRemoval (this, 'checkbox');">This &lt;div&gt; has role 'button'</div>
     26    </div>
     27    <p>
     28      <button onclick="changeRoleByRemoval (document.getElementById ('test'), 'checkbox')" type="button">Change Role</button>
     29      <button onclick="window.location.reload()" type="button">Reload Page</button>
     30    </p>
     31  </body>
     32 </html>