File: script-common.html

package info (click to toggle)
firefox 149.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,767,760 kB
  • sloc: cpp: 7,416,064; javascript: 6,752,859; ansic: 3,774,850; python: 1,250,473; xml: 641,578; asm: 439,191; java: 186,617; sh: 56,634; makefile: 18,856; objc: 13,092; perl: 12,763; pascal: 5,960; yacc: 4,583; cs: 3,846; lex: 1,720; ruby: 1,002; php: 436; lisp: 258; awk: 105; sql: 66; sed: 53; csh: 10; exp: 6
file content (55 lines) | stat: -rw-r--r-- 1,703 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test: </title>
<link rel="help" href="https://svgwg.org/svg2-draft/interact.html#ScriptElement">
<meta name="assert" content="The same scripts can work on both HTML and SVG elements.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>var total = 0;</script>
<script>function s0() { total += 100; return s1(); }</script>
<svg>
  <script>function s1() { total += 20; return s2(); }</script>
  <g>
    <script>function s2() { return s3(); }</script>
    <circle id="spot"><clipPath id="spot-first-child"/>
      <script>function s3() { return s4(); }</script>
    </circle>
  </g>
  <desc>
    <script>function s4() { return s5(); }</script>
  </desc>
  <filter>
    <script>function s5() { return s6(); }</script>
    <feFlood>
      <script>function s6() { return s7(); }</script>
    </feFlood>
  </filter>
  <text>
    <script>function s7() { return s8(); }</script>
    <tspan>
      <script>function s8() { return s9(); }</script>
    </tspan>
  </text>
  <use href="spot">
    <script>function s9() { return s10(); }</script>
  </use>
</svg>
<div id="box"><script id="box-first-child">function s10() { total += 3; return s11(); }</script>
  <span>
    <script>function s11() { return 'same'; }</script>
  </span>
</div>

<script>
test(function(){
  assert_equals(s0(), 'same');
  assert_equals(total, 123);

  for (let elementName of ['spot', 'box']) {
    let element = document.getElementById(elementName);
    let firstChild = element.firstChild;
    assert_equals(firstChild.id, elementName + '-first-child');
  }
}, 'The same scripts work on both HTML and SVG elements');
</script>