<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

function handleNodeRemoved(event)
{
    document.removeEventListener("DOMNodeRemoved", handleNodeRemoved, false);
    firstUseElement.id = "B";
}

document.addEventListener("DOMNodeRemoved", handleNodeRemoved, false);
</script>
</head>
<body>
<p>This tests that we don't cause an assertion failure when changing the id of a &lt;use&gt; on removal from the document despite a later &lt;use&gt; referencing its former id.</p>
<svg>
    <use id="A"></use>
    <use id="A"></use>
    <use xlink:href="#A"></use>
</svg>
<script>
var firstUseElement = document.querySelector("use");
var svg = document.querySelector("svg");
document.body.removeChild(svg);
</script>
<p>PASS</p>
</body>
</html>
