tor-browser

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

script-for-event.html (2129B)


      1 <!DOCTYPE html>
      2 <title>Scripts with for and event attributes</title>
      3 <link rel="author" title="Matheus Kerschbaum" href="mailto:matjk7@gmail.com">
      4 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#prepare-a-script">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <div id="log"></div>
      9 <script>
     10 var expected = [
     11  false,
     12  false,
     13  false,
     14  false,
     15  false,
     16  false,
     17  false,
     18  false,
     19  false,
     20  false,
     21  false,
     22  false,
     23  true,
     24  true,
     25  false,
     26  true,
     27  true,
     28 ];
     29 var run = expected.map(function() { return false });
     30 </script>
     31 <script for="w&#x130;ndow" event="onload">
     32 run[0] = true;
     33 </script>
     34 <script for="window" event="onload x">
     35 run[1] = true;
     36 </script>
     37 <script for="window" event="onload(x">
     38 run[2] = true;
     39 </script>
     40 <script for="window" event="onload(x)">
     41 run[3] = true;
     42 </script>
     43 <script for="window" event="onclick">
     44 run[4] = true;
     45 </script>
     46 <script for="" event="onload">
     47 run[5] = true;
     48 </script>
     49 <script for="window" event="">
     50 run[6] = true;
     51 </script>
     52 <script for="" event="">
     53 run[7] = true;
     54 </script>
     55 <script for="&#xa0;window" event="onload">
     56 run[8] = true;
     57 </script>
     58 <script for="window&#xa0;" event="onload">
     59 run[9] = true;
     60 </script>
     61 <script for="window" event="&#xa0;onload">
     62 run[10] = true;
     63 </script>
     64 <script for="window" event="onload&#xa0;">
     65 run[11] = true;
     66 </script>
     67 <script for=" window " event=" onload ">
     68 run[12] = true;
     69 </script>
     70 <script for=" window " event=" onload() ">
     71 run[13] = true;
     72 </script>
     73 <script for="object" event="handler">
     74 run[14] = true;
     75 </script>
     76 <script event="handler">
     77 run[15] = true;
     78 </script>
     79 <script for="object">
     80 run[16] = true;
     81 </script>
     82 <script>
     83 test(function() {
     84  for (var i = 0; i < run.length; ++i) {
     85    test(function() {
     86      var script = document.querySelectorAll("script[for], script[event]")[i];
     87      assert_equals(run[i], expected[i],
     88                    "script for=" + format_value(script.getAttribute("for")) +
     89                    " event=" + format_value(script.getAttribute("event")));
     90    }, "Script " + i);
     91  }
     92 });
     93 </script>