| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| <html> | |
| <head> | |
| <script src="../../resources/js-test.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.attachShadow({mode: 'open'}); | |
| node.shadowRoot.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(div.shadowRoot); internals.rangeAsText(range)', '"b"'); | |
| shouldBe('appendBrElement(div.shadowRoot.childNodes[0]); range.selectNodeContents(div.shadowRoot); internals.rangeAsText(range)', '"b\\n"'); | |
| document.body.removeChild(subframe); | |
| var successfullyParsed = true; | |
| </script> | |
| </body> | |
| </html> |