test_bug870787.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=870787
  5. -->
  6. <head>
  7. <title>Test for Bug 870787</title>
  8. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <script type="application/javascript" src="reflect.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=870787">Mozilla Bug 870787</a>
  14. <p id="msg"></p>
  15. <form id="form0"></form>
  16. <img name="img0" id="img0id">
  17. <img name="img1" id="img1id" />
  18. <form id="form1">
  19. <img name="img2" id="img2id" />
  20. </form>
  21. <img name="img3" id="img3id" />
  22. <table>
  23. <form id="form2">
  24. <tr><td>
  25. <button name="input1" id="input1id" />
  26. <input name="input2" id="input2id" />
  27. </form>
  28. </table>
  29. <table>
  30. <form id="form3">
  31. <tr><td>
  32. <img name="img4" id="img4id" />
  33. <img name="img5" id="img5id" />
  34. </form>
  35. </table>
  36. <form id="form4"><img id="img6"></form>
  37. <pre id="test">
  38. <script type="application/javascript">
  39. /** Test for Bug 870787 **/
  40. var form0 = document.getElementById("form0");
  41. ok(form0, "Form0 exists");
  42. ok(!form0.img0, "Form0.img0 doesn't exist");
  43. ok(!form0.img0id, "Form0.img0id doesn't exist");
  44. var form1 = document.getElementById("form1");
  45. ok(form1, "Form1 exists");
  46. ok(!form1.img1, "Form1.img1 doesn't exist");
  47. ok(!form1.img1id, "Form1.img1id doesn't exist");
  48. is(form1.img2, document.getElementById("img2id"), "Form1.img2 exists");
  49. is(form1.img2id, document.getElementById("img2id"), "Form1.img2id exists");
  50. ok(!form1.img3, "Form1.img3 doesn't exist");
  51. ok(!form1.img3id, "Form1.img3id doesn't exist");
  52. var form2 = document.getElementById("form2");
  53. ok(form2, "Form2 exists");
  54. is(form2.input1, document.getElementById("input1id"), "Form2.input1 exists");
  55. is(form2.input1id, document.getElementById("input1id"), "Form2.input1id exists");
  56. is(form2.input2, document.getElementById("input2id"), "Form2.input2 exists");
  57. is(form2.input2id, document.getElementById("input2id"), "Form2.input2id exists");
  58. var form3 = document.getElementById("form3");
  59. ok(form3, "Form3 exists");
  60. is(form3.img4, document.getElementById("img4id"), "Form3.img4 doesn't exists");
  61. is(form3.img4id, document.getElementById("img4id"), "Form3.img4id doesn't exists");
  62. is(form3.img5, document.getElementById("img5id"), "Form3.img5 doesn't exists");
  63. is(form3.img5id, document.getElementById("img5id"), "Form3.img5id doesn't exists");
  64. var form4 = document.getElementById("form4");
  65. ok(form4, "Form4 exists");
  66. is(Object.getOwnPropertyNames(form4.elements).indexOf("img6"), -1, "Form4.elements should not contain img6");
  67. </script>
  68. </pre>
  69. </body>
  70. </html>