<!DOCTYPE html>
<div>
  <p>Clicking the green rectangle should attempt a navigation to the fragment identifier.</p>
  <svg width="300" height="200" onload="runTest()">
    <a xlink:href="#test">
      <rect width="100" height="100" fill="green"/>
    </a>
  </svg>
</div>
<script>
if (window.testRunner) {
  testRunner.waitUntilDone();
  testRunner.dumpAsText();
}

function runTest() {
  var evt = document.createEvent("MouseEvents"); 
  evt.initMouseEvent("click", true, true, window,
        0, 0, 0, 0, 0, false, false, false, false, 0, null); 
  document.querySelector('a').dispatchEvent(evt);
  window.setTimeout(function checkNavigation() {
    var result = location.hash === '#test' ? 'PASS' : 'FAIL';
    document.documentElement.appendChild(document.createTextNode(result));
    if (window.testRunner)
      testRunner.notifyDone();
  }, 0);
}
</script>
