<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<meter id="target" min="0" max="100" value="50" style="appearance: none;" />
<script>
(function() {
    target = document.getElementById("target");
    cloned = target.cloneNode();
    document.body.insertBefore(cloned, target.nextSibling);

    if (!window.internals) {
        debug("You need internals to run this test.");
        return;
    }

    targetShadowRoot = internals.shadowRoot(target);
    clonedShadowRoot = internals.shadowRoot(cloned);
    targetInnerElement = targetShadowRoot.querySelector("#inner");
    clonedInnerElement = clonedShadowRoot.querySelector("#inner");

    shouldBe("cloned.value", "target.value");
    shouldBe("internals.shadowPseudoId(clonedInnerElement)", "internals.shadowPseudoId(targetInnerElement)");
    shouldBe("internals.shadowPseudoId(clonedInnerElement.firstChild)", "internals.shadowPseudoId(targetInnerElement.firstChild)");
    shouldBe("internals.shadowPseudoId(clonedInnerElement.firstChild.firstChild)", "internals.shadowPseudoId(targetInnerElement.firstChild.firstChild)");

    cloned.value = 70;
    shouldBe("clonedInnerElement.firstChild.firstChild.style.inlineSize", '"70%"');
    shouldBe("targetInnerElement.firstChild.firstChild.style.inlineSize", '"50%"');
})();
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
