1 <html xmlns='http://www.w3.org/
1999/xhtml'
>
19 <p>Test for bug 34714 - onclick is not reliable for transformed SVG elements. This test checks that elementFromPoint() works correctly with an SVG rect element (green) defined within a 1x1 viewbox.</p>
20 <p>On success, you will see a series of "PASS
" messages</p>
21 <pre id="console
"></pre>
23 <svg id="svgRoot
" width="400px
" height="400px
" viewBox="0 0 1 1" xmlns="http://www.w3.org/
2000/svg
">
24 <g transform="translate(
0.5,
0)
">
25 <rect id="rect
" width="1" height="1" transform="translate(-
0.499,
0)
"/>
30 if (window.testRunner) {
31 testRunner.dumpAsText();
34 var resultString = "";
35 var rectElt = document.getElementById("rect
");
38 {x: 1, y: 1}, // fails without the fix
39 {x: 1, y: 399}, // fails without the fix
45 pointsInRect.forEach( function(point) {
46 var pass = (rectElt == document.elementFromPoint(point.x, point.y));
47 resultString += ((pass) ? "PASS
" : "FAIL
") + " rect contains point
@ " + point.x + ", " + point.y + "\n";
50 var pointsNotInRect = [
57 pointsNotInRect.forEach( function(point) {
58 var pass = (rectElt != document.elementFromPoint(point.x, point.y));
59 resultString += ((pass) ? "PASS
" : "FAIL
") + " rect does not contain point
@ " + point.x + ", " + point.y + "\n";
62 document.getElementById("console
").innerHTML = resultString;