test_bug694503.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=694503
  5. -->
  6. <head>
  7. <title>Test for Bug 694503</title>
  8. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <script type="application/javascript" src="/tests/SimpleTest/EventUtils.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=694503">Mozilla Bug 694503</a>
  14. <p id="display"></p>
  15. <div id="content" style="display: none">
  16. </div>
  17. <div>
  18. <map name="map1">
  19. <area onclick="++mapClickCount; event.preventDefault();"
  20. coords="0,0,50,50" shape="rect">
  21. </map>
  22. </div>
  23. <img id="img"
  24. usemap="#map1" alt="Foo bar" src="about:logo">
  25. <pre id="test">
  26. <script type="application/javascript">
  27. /** Test for Bug 694503 **/
  28. var mapClickCount = 0;
  29. SimpleTest.waitForExplicitFinish();
  30. SimpleTest.waitForFocus(function() {
  31. var m = document.getElementsByTagName("map")[0];
  32. var img = document.getElementById('img');
  33. var origName = m.name;
  34. synthesizeMouse(img, 25, 25, {});
  35. is(mapClickCount, 1, "Wrong click count (1)");
  36. m.name = "foo"
  37. synthesizeMouse(img, 25, 25, {});
  38. is(mapClickCount, 1, "Wrong click count (2)");
  39. m.removeAttribute("name");
  40. m.id = origName;
  41. synthesizeMouse(img, 25, 25, {});
  42. is(mapClickCount, 2, "Wrong click count (3)");
  43. // Back to original state
  44. m.removeAttribute("id");
  45. m.name = origName;
  46. synthesizeMouse(img, 25, 25, {});
  47. is(mapClickCount, 3, "Wrong click count (4)");
  48. var p = m.parentNode;
  49. p.removeChild(m);
  50. synthesizeMouse(img, 25, 25, {});
  51. is(mapClickCount, 3, "Wrong click count (5)");
  52. // Back to original state
  53. p.appendChild(m);
  54. synthesizeMouse(img, 25, 25, {});
  55. is(mapClickCount, 4, "Wrong click count (6)");
  56. SimpleTest.finish();
  57. });
  58. </script>
  59. </pre>
  60. </body>
  61. </html>