File: script-common.html

package info (click to toggle)
firefox-esr 68.10.0esr-1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,143,932 kB
  • sloc: cpp: 5,227,879; javascript: 4,315,531; ansic: 2,467,042; python: 794,975; java: 349,993; asm: 232,034; xml: 228,320; sh: 82,008; lisp: 41,202; makefile: 22,347; perl: 15,555; objc: 5,277; cs: 4,725; yacc: 1,778; ada: 1,681; pascal: 1,673; lex: 1,417; exp: 527; php: 436; ruby: 225; awk: 162; sed: 53; csh: 44
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>