summaryrefslogtreecommitdiffstats
path: root/dom/html/test/test_bug870787.html
blob: d6f66dda32642c8506abcbb6011947c60fd24a24 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=870787
-->
<head>
  <title>Test for Bug 870787</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="reflect.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=870787">Mozilla Bug 870787</a>

<p id="msg"></p>

<form id="form0"></form>
<img name="img0" id="img0id">

<img name="img1" id="img1id" />
<form id="form1">
  <img name="img2" id="img2id" />
</form>
<img name="img3" id="img3id" />

<table>
  <form id="form2">
  <tr><td>
    <button name="input1" id="input1id" />
    <input name="input2" id="input2id" />
  </form>
</table>

<table>
  <form id="form3">
  <tr><td>
    <img name="img4" id="img4id" />
    <img name="img5" id="img5id" />
  </form>
</table>

<form id="form4"><img id="img6"></form>

<pre id="test">
<script type="application/javascript">

/** Test for Bug 870787 **/

var form0 = document.getElementById("form0");
ok(form0, "Form0 exists");
ok(!form0.img0, "Form0.img0 doesn't exist");
ok(!form0.img0id, "Form0.img0id doesn't exist");

var form1 = document.getElementById("form1");
ok(form1, "Form1 exists");
ok(!form1.img1, "Form1.img1 doesn't exist");
ok(!form1.img1id, "Form1.img1id doesn't exist");
is(form1.img2, document.getElementById("img2id"), "Form1.img2 exists");
is(form1.img2id, document.getElementById("img2id"), "Form1.img2id exists");
ok(!form1.img3, "Form1.img3 doesn't exist");
ok(!form1.img3id, "Form1.img3id doesn't exist");

var form2 = document.getElementById("form2");
ok(form2, "Form2 exists");
is(form2.input1, document.getElementById("input1id"), "Form2.input1 exists");
is(form2.input1id, document.getElementById("input1id"), "Form2.input1id exists");
is(form2.input2, document.getElementById("input2id"), "Form2.input2 exists");
is(form2.input2id, document.getElementById("input2id"), "Form2.input2id exists");

var form3 = document.getElementById("form3");
ok(form3, "Form3 exists");
is(form3.img4, document.getElementById("img4id"), "Form3.img4 doesn't exists");
is(form3.img4id, document.getElementById("img4id"), "Form3.img4id doesn't exists");
is(form3.img5, document.getElementById("img5id"), "Form3.img5 doesn't exists");
is(form3.img5id, document.getElementById("img5id"), "Form3.img5id doesn't exists");

var form4 = document.getElementById("form4");
ok(form4, "Form4 exists");
is(Object.getOwnPropertyNames(form4.elements).indexOf("img6"), -1, "Form4.elements should not contain img6");

</script>
</pre>
</body>
</html>