<!DOCTYPE html>
<html>
<svg width=80 height=40>
  <defs>
    <rect id="square" x=4 y=4 width=32 height=32 fill=orange></rect>
  </defs>

  <use id="leftSquare" xlink:href="#square"></use>
  <use xlink:href="#square" x=40></use>
</svg>

<script>
  	if (window.testRunner)
        testRunner.dumpAsText();

    var leftSquare = document.getElementById("leftSquare");
    var square = document.getElementById("square");

    leftSquare.addEventListener('mousedown', function() { leftSquare.parentNode.appendChild(leftSquare); });
    leftSquare.addEventListener('mousedown', function() { square.setAttribute("fill", "green"); });

    if (window.eventSender) {
        eventSender.mouseMoveTo(20, 20);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
</script>
<p>Test re-appending a use node with multiple event listeners, triggered by the first listener.
  If running manually, click on the left square.
  Pass if no crash and the visible result is an orange square left of a green square.</p>
</html>