Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / text-iterator / basic-iteration-shadowdom.html
blob17e871553a928cc2c9484d4afb16a3bf9475e58f
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
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;
41 </script>
42 </body>
43 </html>