Skip to content

Truly independent web browser

1.1 KB
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
    .card::part(popup) { color: rgb(1, 2, 3) }
    [placement="bottom"]::part(popup) { background-color: rgb(4, 5, 6) }
    x-thing::part(popup) { outline-color: rgb(7, 8, 9) }
    ::part(popup) { border-top-color: rgb(10, 11, 12) }
</style>
<x-thing id="thing" class="card" placement="bottom"></x-thing>
<script>
    test(() => {
        const root = document.getElementById("thing").attachShadow({ mode: "open" });
        root.innerHTML = `<div part="popup">popup</div>`;
        // A `::part()` rule's outer compound describes the host the part is exposed to, so a class or
        // an attribute on it has to be tested there rather than on the part itself.
        const part = root.querySelector("div");
        println("color: " + getComputedStyle(part).color);
        println("background-color: " + getComputedStyle(part).backgroundColor);
        println("outline-color: " + getComputedStyle(part).outlineColor);
        println("border-top-color: " + getComputedStyle(part).borderTopColor);
        println(internals.styleEngineMatchedRules());
    });
</script>