1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=676001
6 <title>Test hit-testing of stroke
</title>
9 :hover { stroke: lime; }
12 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
16 <script class=
"testbody" type=
"text/javascript">
19 SimpleTest.waitForExplicitFinish();
22 var div = document.getElementById(
"div");
23 var line = document.getElementById(
"line");
24 var circle = document.getElementById(
"circle");
25 var offsetX = div.offsetLeft;
26 var offsetY = div.offsetTop;
30 got = document.elementFromPoint(offsetX +
116, offsetY +
103);
31 is(got, line,
"Should hit line (1)");
33 got = document.elementFromPoint(offsetX +
123, offsetY +
108);
34 is(got, line,
"Should hit line (2)");
37 got = document.elementFromPoint(offsetX +
188, offsetY +
158);
38 is(got, circle,
"Should hit circle (1)");
40 got = document.elementFromPoint(offsetX +
185, offsetY +
162);
41 is(got, circle,
"Should hit circle (2)");
48 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=676001">Mozilla Bug
676001</a>
52 <div width=
"100%" height=
"1" id=
"div"></div>
53 <svg xmlns=
"http://www.w3.org/2000/svg" id=
"svg" width=
"500" height=
"300">
54 <line id=
"line" x1=
"100" y1=
"100" x2=
"600" y2=
"180"
55 stroke=
"red" stroke-width=
"40"/>
56 <!-- the circle test points need to be within the mochitest test harness
57 viewport for test content in order for elementFromPoint to work -->
58 <circle id=
"circle" cx=
"100" cy=
"150" r=
"100"
59 fill=
"none" stroke=
"red" stroke-width=
"40"/>