Moving word boundaries backwards fails when there is a text node starting with an...
[WebKit-https.git] / LayoutTests / editing / selection / previous-word-boundary-across-text-nodes.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>This test checks moving to the previous word boundary across multiple text nodes.<br>
5 For example, when "I" and "'ll" are put in a separate text node, we should not erroneously report the previous word boundary to be between "'" and "ll".</p>
6 <div id="tests" style="font-size: 20px;" >
7 <div contenteditable><span>I</span>'ll</div>
8 <div contenteditable><span>I'</span>ll</div>
9 <div contenteditable><span>I'l</span>l</div>
10 <div contenteditable>I'<span>ll</span></div>
11 <div contenteditable>I<span>'l</span>l</div>
12 <div contenteditable><span>e</span>&#x301;'ll</div>
13 <div contenteditable><span>e&#x301;</span>'ll</div>
14 <div contenteditable><span>e&#x301;'</span>ll</div>
15 <div contenteditable><span>e&#x301;'l</span>l</div>
16 <div contenteditable>e<span>&#x301;</span>'ll</div>
17 <div contenteditable>e<span>&#x301;'</span>ll</div>
18 <div contenteditable>e<span>&#x301;'l</span>l</div>
19 <div contenteditable>e<span>&#x301;'ll</span></div>
20 <div contenteditable>e&#x301;<span>'</span>ll</div>
21 <div contenteditable>e&#x301;<span>'l</span>l</div>
22 <div contenteditable>e&#x301;<span>'ll</span></div>
23 <div contenteditable>e&#x301;<span>'</span>ll</div>
24 <div contenteditable>e&#x301;<span>'l</span>l</div>
25 <div contenteditable>e&#x301;<span>'ll</span></div>
26 <div contenteditable>e&#x301;'<span>l</span>l</div>
27 </div>
28 <script src="../../fast/js/resources/js-test-pre.js"></script>
29 <script>
30
31 function selectWordBackward(container) {
32     getSelection().collapse(container, container.childNodes.length);
33     getSelection().modify('extend', 'backward', 'word');
34 }
35
36 var tests = document.getElementById('tests').children;
37 for (var i = 0; i < tests.length; i++) {
38     var container = tests[i];
39     shouldBeEqualToString("selectWordBackward(container); /* " + container.innerHTML + " */ getSelection().toString();", container.textContent);
40 }
41 document.getElementById('tests').style.display = 'none';
42
43 </script>
44 </body>
45 </html>