summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/shadow/content-element-outside-shadow.html
blob: 0ec3d132f4cfd5f601494d300f56ce41676b1656 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<body>

<div id="targetContainer" style="position: relative;"></div>
<div id="comparisonContainer" style="position: relative;"></div>

<script src="../../../resources/js-test.js"></script>
<script><!--
description("HTMLContentElement should be able to survive even outside shadow.");

function removeContainerLines(text)
{
    var lines = text.split("\n");
    lines.splice(0, 2);
    return lines.join("\n");
}

var cases = [
    ["<div><content></content></div>",
     "<div><unknown></unknown></div>"],
    ["<div><content>Here is a text.</content></div>",
     "<div><unknown>Here is a text.</unknown></div>"],
    ["<div><content><div>Here is a </div><div>series of</div><div>blocks</div></content></div>",
     "<div><unknown><div>Here is a </div><div>series of</div><div>blocks</div></unknown></div>"],
    ["<div><content><span>Here is a<span><span>series of</span><span>inlines.</span></content></div>",
     "<div><unknown><span>Here is a<span><span>series of</span><span>inlines.</span></unknown></div>"],
    ["<div><content>Here is a <content>nested content</content> inside content.</content></div>",
     "<div><unknown>Here is a <unknown>nested content</unknown> inside content.</unknown></div>"],
    ["<div><content>Here is a <div>block and <content>nested content</content> inside the block</div>.</content></div>",
     "<div><unknown>Here is a <div>block and <unknown>nested content</unknown> inside the block</div>.</unknown></div>"]
];

var targetContainer = document.getElementById("targetContainer");
var comparisonContainer = document.getElementById("comparisonContainer");

for (var i = 0; i < cases.length; ++i) {
    var targetMarkup = cases[i][0];
    var expectedMarkup = cases[i][1];

    targetContainer.innerHTML = targetMarkup;
    comparisonContainer.innerHTML = expectedMarkup;
    targetLayoutTree = removeContainerLines(window.internals.elementLayoutTreeAsText(targetContainer));
    targetLayoutTree = targetLayoutTree.replace(/CONTENT/g, "UNKNOWN");
    comparisonLayoutTree = removeContainerLines(window.internals.elementLayoutTreeAsText(comparisonContainer));
    debug(escapeHTML(targetMarkup));
    shouldBe("targetLayoutTree", "comparisonLayoutTree");
}

targetContainer.innerHTML = comparisonContainer.innerHTML = "";

--></script>
</body>
</html>