blob: f6e93e8a8360b0f5022ed0057c5c7d9681c9fbbf (
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
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../fast/js/resources/js-test-pre.js"></script>
<script src="resources/js-test-selection-shared.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('Unit tests for WebCore text iterator with shadow tree support enabled');
var subframe = document.createElement('iframe');
document.body.appendChild(subframe);
function appendBrElement(node)
{
node.appendChild(document.createElement('br'));
}
function addShadowTreeWithDivElement(node)
{
node.createShadowRoot();
internals.oldestShadowRoot(node).innerHTML = '<div>b</div>';
}
var testDocument = subframe.contentDocument;
var range = testDocument.createRange();
var head = testDocument.createElement("head");
testDocument.documentElement.insertBefore(head, testDocument.documentElement.firstChild);
testDocument.body.innerHTML = '<div>a</div>';
var div = testDocument.body.childNodes[0];
shouldBe('addShadowTreeWithDivElement(div); range.selectNodeContents(internals.oldestShadowRoot(div)); internals.rangeAsText(range)', '"b"');
shouldBe('appendBrElement(internals.oldestShadowRoot(div).childNodes[0]); range.selectNodeContents(internals.oldestShadowRoot(div)); internals.rangeAsText(range)', '"b\\n"');
document.body.removeChild(subframe);
var successfullyParsed = true;
</script>
</body>
</html>
|