<body>
    <p>Test passes if it does not assert in debug builds.</p>
    <svg id="svg">
        <pattern id="svg-pattern-1">
            <use id="svg-use" href="#svg"/>
        </pattern>
        <pattern id="svg-pattern-2" href="#svg-use">
        </pattern>
    </svg>
    <shadow id="shadow">
        <svg>
            <tref href="#svg-pattern-2"/>
            <use href="#svg-use"/>
        </svg>
    </shadow>
    <script>
        if (window.testRunner)
            testRunner.dumpAsText();
        window.addEventListener('load', function() {
            var svgPattern2 = document.getElementById("svg-pattern-2");
            var shadow = document.getElementById("shadow");
            svgPattern2.after(shadow);
        }, false);
    </script>
</body>
