test_bug694503.html (1825B)
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 src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script 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 18 <div> 19 <map name="map1"> 20 <area onclick="++mapClickCount; event.preventDefault();" 21 coords="0,0,50,50" shape="rect"> 22 </map> 23 </div> 24 25 <img id="img" 26 usemap="#map1" alt="Foo bar" src="about:logo"> 27 <pre id="test"> 28 <script type="application/javascript"> 29 30 /** Test for Bug 694503 */ 31 32 var mapClickCount = 0; 33 34 SimpleTest.waitForExplicitFinish(); 35 SimpleTest.waitForFocus(function() { 36 var m = document.getElementsByTagName("map")[0]; 37 var img = document.getElementById('img'); 38 var origName = m.name; 39 40 synthesizeMouse(img, 25, 25, {}); 41 is(mapClickCount, 1, "Wrong click count (1)"); 42 43 m.name = "foo" 44 synthesizeMouse(img, 25, 25, {}); 45 is(mapClickCount, 1, "Wrong click count (2)"); 46 47 m.removeAttribute("name"); 48 m.id = origName; 49 synthesizeMouse(img, 25, 25, {}); 50 is(mapClickCount, 2, "Wrong click count (3)"); 51 52 // Back to original state 53 m.removeAttribute("id"); 54 m.name = origName; 55 synthesizeMouse(img, 25, 25, {}); 56 is(mapClickCount, 3, "Wrong click count (4)"); 57 58 var p = m.parentNode; 59 p.removeChild(m); 60 synthesizeMouse(img, 25, 25, {}); 61 is(mapClickCount, 3, "Wrong click count (5)"); 62 63 // Back to original state 64 p.appendChild(m); 65 synthesizeMouse(img, 25, 25, {}); 66 is(mapClickCount, 4, "Wrong click count (6)"); 67 68 SimpleTest.finish(); 69 }); 70 71 72 </script> 73 </pre> 74 </body> 75 </html>