OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>Test that when image map areas have their shape or coordinate dynamically
altered, the test region changes.</title> | |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <img usemap="#m" style="height:400px; width:400px; border:1px solid red; positio
n:absolute; left:0; right:0" > | |
6 <map name="m"> | |
7 <area href="#"> | |
8 </map> | |
9 <script> | |
10 test(function() { | |
11 var area = document.querySelector('area'); | |
12 function checkPointInArea(shape, coords, x, y, equals) { | |
13 area.setAttribute('shape', shape); | |
14 area.setAttribute('coords', coords); | |
15 equals ? assert_equals(area, document.elementFromPoint(x, y)) | |
16 : assert_not_equals(area, document.elementFromPoint(x, y)); | |
17 } | |
18 checkPointInArea('default', '', 50, 50, true); | |
19 checkPointInArea('default', '', 50, 50, true); | |
20 checkPointInArea('rect', '0, 0, 100, 100', 50, 50, true); | |
21 checkPointInArea('rect', '0, 0, 100, 100', 150, 150, false); | |
22 checkPointInArea('rect', '200, 200, 300, 300', 50, 50, false); | |
23 checkPointInArea('rect', '200, 200, 300, 300', 250, 250, true); | |
24 checkPointInArea('circle', '100, 100, 50', 100, 100, true); | |
25 checkPointInArea('circle', '100, 100, 50', 120, 100, true); | |
26 checkPointInArea('circle', '100, 100, 50', 200, 100, false); | |
27 checkPointInArea('circle', '300, 300, 50', 100, 100, false); | |
28 checkPointInArea('circle', '300, 300, 50', 300, 300, true); | |
29 checkPointInArea('circle', '300, 300, 50', 320, 300, true); | |
30 checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 150, 150, true); | |
31 checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 100, 150, false); | |
32 checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 300, 300, false); | |
33 checkPointInArea('default', '', 300, 300, true); | |
34 }); | |
35 </script> | |
OLD | NEW |