summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/html/details-clone.html
blob: 0aa5523c8e56af6a7debf5ce25721724acda8ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
function runTest()
{
    var targetDetails = document.getElementById("targetDetails");
    var clonedDetails = targetDetails.cloneNode(true);
    document.body.appendChild(clonedDetails);
    var targetSummary = document.getElementById("targetSummary");
    var clonedSummary = targetSummary.cloneNode(true);
    targetDetails.appendChild(clonedSummary);

    if (!window.internals)
        return;

    // On cloned <details>, marker shadow element should be created
    var targetDetailsSummaryShadow = internals.shadowRoot(targetDetails.querySelector("summary"));
    targetMarkerPseudoId = internals.shadowPseudoId(targetDetailsSummaryShadow.firstChild);
    var clonedDetailsSummaryShadow = internals.shadowRoot(clonedDetails.querySelector("summary"));
    clonedMarkerPseudoId = internals.shadowPseudoId(clonedDetailsSummaryShadow.firstChild);
    shouldBe("targetMarkerPseudoId", "clonedMarkerPseudoId");
}
</script>
<body onload="runTest()">
<p id="description">Test to clone details and summary elements</p>
<div id="console"></div>
<details id="targetDetails" open>
   <summary id="targetSummary"></summary>
</details>
</body>
</html>