<!DOCTYPE html>
<html>
<head>
<style>
svg {
    height: 128px;
    width: 128px;
}
</style>
</head>
<body>
<!-- This tests that we don't cause an assertion failure when removing a <use>, with the same id another element, that is referenced by a later <use>. -->
<svg>
    <defs>
        <rect id="pass" x="0" y="0" width="128" height="128" fill="green"></rect>
        <rect id="fail" x="0" y="0" width="128" height="128" fill="red"></rect>
        <use id="A" xlink:href="#fail"></use>
        <use id="A" xlink:href="#pass"></use>
    </defs>
    <use xlink:href="#A"></use>
</svg>
<script>
var firstUseElement = document.querySelector("use");
firstUseElement.parentNode.removeChild(firstUseElement);
</script>
</body>
</html>
