Skip to content

Truly independent web browser

891 B
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
    .shape { fill: red }
    rect { stroke: blue }
</style>
<svg width="100" height="100">
    <defs><rect id="src" class="shape" width="10" height="10"></rect></defs>
    <use href="#src"></use>
</svg>
<script>
    test(() => {
        // An `<svg:use>` clones into a shadow root that decides with the document's author sheets
        // rather than with sheets of its own, so the document's rules reach the clone. The second
        // one arrives after its host already has an identity, which is the order that used to lose
        // the flag.
        const svg = document.querySelector("svg");
        const use = document.createElementNS("http://www.w3.org/2000/svg", "use");
        use.setAttribute("href", "#src");
        svg.appendChild(use);
        println(internals.styleEngineMatchedRules());
    });
</script>