<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
    testRunner.dumpAsText();
</script>
<style>
svg {
    height: 128px;
    width: 128px;
}
</style>
</head>
<body>
<p>This tests that we don't cause an assertion failure when implicitly removing a &lt;use&gt; (by removing its parent), with the same id as another element, that is referenced by a later &lt;use&gt; in a different SVG subtree.</p>
<svg id="svg1">
    <defs>
        <text id="fail" x="0" y="20">FAIL</text>
    </defs>
    <use id="A" xlink:href="#fail"></use>
    <use id="A" xlink:href="#fail"></use>
</svg>
<svg>
    <use xlink:href="#A"></use>
</svg>
<script>
var svg = document.getElementById("svg1");
document.body.removeChild(svg);
</script>
<p>PASS</p>
</body>
</html>
