| <html xmlns='http://www.w3.org/1999/xhtml'> |
| <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> |
| <p>On success, you will see a series of "PASS" messages</p> |
| <svg id="svgRoot" width="400px" height="400px" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg"> |
| <g transform="translate(0.5, 0)"> |
| <rect id="rect" width="1" height="1" transform="translate(-0.499, 0)"/> |
| var rectElt = document.getElementById("rect"); |
| {x: 1, y: 1}, // fails without the fix |
| {x: 1, y: 399}, // fails without the fix |
| pointsInRect.forEach( function(point) { |
| var pass = (rectElt == document.elementFromPoint(point.x, point.y)); |
| resultString += ((pass) ? "PASS " : "FAIL ") + " rect contains point @ " + point.x + ", " + point.y + "\n"; |
| pointsNotInRect.forEach( function(point) { |
| var pass = (rectElt != document.elementFromPoint(point.x, point.y)); |
| resultString += ((pass) ? "PASS " : "FAIL ") + " rect does not contain point @ " + point.x + ", " + point.y + "\n"; |
| document.getElementById("console").innerHTML = resultString; |