tor-browser

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

dir-auto-dynamic-simple-replace.html (1301B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3 <meta charset="utf-8">
      4 <title>Dynamic changes with textContent and dir=auto</title>
      5 <link rel="match" href="dir-auto-dynamic-simple-ref.html">
      6 <div>Test for elements with dir="auto" whose content changes between directional and neutral</div>
      7 <div dir="auto" id="from_ltr_to_ltr">abc</div>
      8 <div dir="auto" id="from_ltr_to_rtl">abc</div>
      9 <div dir="auto" id="from_ltr_to_neutral">abc</div>
     10 <div dir="auto" id="from_rtl_to_ltr">אבג</div>
     11 <div dir="auto" id="from_rtl_to_rtl">אבג</div>
     12 <div dir="auto" id="from_rtl_to_neutral">אבג</div>
     13 <div dir="auto" id="from_neutral_to_ltr">123</div>
     14 <div dir="auto" id="from_neutral_to_rtl">123</div>
     15 <div dir="auto" id="from_neutral_to_neutral">123</div>
     16 <script>
     17 function changeContent() {
     18  var directionalTexts = {ltr:"xyz", rtl:"ابج", neutral:"456"};
     19 
     20  for (var dirFrom in directionalTexts) {
     21    for (var dirTo in directionalTexts) {
     22      var element = document.getElementById("from_" + dirFrom +
     23                                            "_to_" + dirTo);
     24      element.firstChild.remove();
     25      element.appendChild(document.createTextNode(directionalTexts[dirTo]));
     26    }
     27  }
     28  document.documentElement.removeAttribute("class");
     29 }
     30 
     31 document.addEventListener("TestRendered", changeContent);
     32 </script>