1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description('Unit tests for WebCore text iterator with shadow tree support enabled');
12 var subframe
= document
.createElement('iframe');
13 document
.body
.appendChild(subframe
);
15 function appendBrElement(node
)
17 node
.appendChild(document
.createElement('br'));
20 function addShadowTreeWithDivElement(node
)
22 node
.createShadowRoot();
23 internals
.oldestShadowRoot(node
).innerHTML
= '<div>b</div>';
26 var testDocument
= subframe
.contentDocument
;
27 var range
= testDocument
.createRange();
29 var head
= testDocument
.createElement("head");
30 testDocument
.documentElement
.insertBefore(head
, testDocument
.documentElement
.firstChild
);
32 testDocument
.body
.innerHTML
= '<div>a</div>';
33 var div
= testDocument
.body
.childNodes
[0];
34 shouldBe('addShadowTreeWithDivElement(div); range.selectNodeContents(internals.oldestShadowRoot(div)); internals.rangeAsText(range)', '"b"');
36 shouldBe('appendBrElement(internals.oldestShadowRoot(div).childNodes[0]); range.selectNodeContents(internals.oldestShadowRoot(div)); internals.rangeAsText(range)', '"b\\n"');
38 document
.body
.removeChild(subframe
);
40 var successfullyParsed
= true;