tor-browser

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

script-common.html (1703B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Test: </title>
      4 <link rel="help" href="https://svgwg.org/svg2-draft/interact.html#ScriptElement">
      5 <meta name="assert" content="The same scripts can work on both HTML and SVG elements.">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 
      9 <script>var total = 0;</script>
     10 <script>function s0() { total += 100; return s1(); }</script>
     11 <svg>
     12  <script>function s1() { total += 20; return s2(); }</script>
     13  <g>
     14    <script>function s2() { return s3(); }</script>
     15    <circle id="spot"><clipPath id="spot-first-child"/>
     16      <script>function s3() { return s4(); }</script>
     17    </circle>
     18  </g>
     19  <desc>
     20    <script>function s4() { return s5(); }</script>
     21  </desc>
     22  <filter>
     23    <script>function s5() { return s6(); }</script>
     24    <feFlood>
     25      <script>function s6() { return s7(); }</script>
     26    </feFlood>
     27  </filter>
     28  <text>
     29    <script>function s7() { return s8(); }</script>
     30    <tspan>
     31      <script>function s8() { return s9(); }</script>
     32    </tspan>
     33  </text>
     34  <use href="spot">
     35    <script>function s9() { return s10(); }</script>
     36  </use>
     37 </svg>
     38 <div id="box"><script id="box-first-child">function s10() { total += 3; return s11(); }</script>
     39  <span>
     40    <script>function s11() { return 'same'; }</script>
     41  </span>
     42 </div>
     43 
     44 <script>
     45 test(function(){
     46  assert_equals(s0(), 'same');
     47  assert_equals(total, 123);
     48 
     49  for (let elementName of ['spot', 'box']) {
     50    let element = document.getElementById(elementName);
     51    let firstChild = element.firstChild;
     52    assert_equals(firstChild.id, elementName + '-first-child');
     53  }
     54 }, 'The same scripts work on both HTML and SVG elements');
     55 </script>