tor-browser

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

script-and-style-elements.html (1298B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>Selection: STYLE and SCRIPT elements should be included in Selection.toString() if they are display!=none</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7 window.onload = function() {
      8  test(function() {
      9    var selection = window.getSelection();
     10    var p1 = document.getElementById("p1");
     11 
     12    var range = document.createRange();
     13    test_block_script();
     14    range.selectNode(p1);
     15    selection.addRange(range);
     16    assert_equals(selection.toString().replace(/\r\n/g, "\n"), '\nstyle { display:block; color: green; } script { color: blue; }\nfunction test_block_script() { let pre = document.createElement("pre"); pre.append(document.createTextNode("PASS")); document.getElementById("p1").append(pre); }\n\nPASS');
     17  });
     18 };
     19 </script>
     20 <div id=log></div>
     21 <div id="p1">
     22 <style style="display:none">#not_included{}</style>
     23 <style>
     24  style { display:block; color: green; }
     25  script { color: blue; }
     26 </style>
     27 <script>function not_included(){}</script>
     28 <script style="display:block">
     29 function test_block_script() {
     30  let pre = document.createElement("pre");
     31  pre.append(document.createTextNode("PASS"));
     32  document.getElementById("p1").append(pre);
     33 }
     34 </script>
     35 </div>
     36 </body>
     37 </html>