OLD | NEW |
1 <div id="container"> | 1 <div id="container"> |
2 <div id="sample" contenteditable="true"></div> | 2 <div id="sample" contenteditable="true"></div> |
3 </div> | 3 </div> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 function $(id) { return document.getElementById(id); } | 6 function $(id) { return document.getElementById(id); } |
7 var sample = $('sample'); | 7 var sample = $('sample'); |
8 var selection = window.getSelection(); | 8 var selection = window.getSelection(); |
9 function testIt(sourceHTML, expectedHTML, expectedNode, expectedOffset) | 9 function testIt(sourceHTML, expectedHTML, expectedNode, expectedOffset) |
10 { | 10 { |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 testIt('a|<br>', '<br>', 'sample', 0); | 34 testIt('a|<br>', '<br>', 'sample', 0); |
35 testIt('a<br>|<br>', 'a<br>', 'sample.firstChild', 1); | 35 testIt('a<br>|<br>', 'a<br>', 'sample.firstChild', 1); |
36 testIt('a<br><br>|<br>', 'a<br><br>', 'sample', 2); | 36 testIt('a<br><br>|<br>', 'a<br><br>', 'sample', 2); |
37 | 37 |
38 testIt('a|<br><br>', '<br><br>', 'sample', 0); | 38 testIt('a|<br><br>', '<br><br>', 'sample', 0); |
39 testIt('a<br>|<br><br>', 'a<br><br>', 'sample.firstChild', 1); | 39 testIt('a<br>|<br><br>', 'a<br><br>', 'sample.firstChild', 1); |
40 testIt('a<br><br>|<br><br>', 'a<br><br><br>', 'sample', 2); | 40 testIt('a<br><br>|<br><br>', 'a<br><br><br>', 'sample', 2); |
41 | 41 |
42 testIt('a<br>|b', 'ab', 'sample.firstChild', 1); | 42 testIt('a<br>|b', 'ab', 'sample.firstChild', 1); |
43 testIt('a<br><br>|b', 'a<br>b', 'sample', 2); | 43 testIt('a<br><br>|b', 'a<br>b', 'sample.lastChild', 0); |
44 testIt('a<br><br><br>|b', 'a<br><br>b', 'sample', 3); | 44 testIt('a<br><br><br>|b', 'a<br><br>b', 'sample.lastChild', 0); |
45 | 45 |
46 testIt('a<br>b|', 'a<br><br>', 'sample', 2); | 46 testIt('a<br>b|', 'a<br><br>', 'sample', 2); |
47 testIt('a<br><br>b|', 'a<br><br><br>', 'sample', 3); | 47 testIt('a<br><br>b|', 'a<br><br><br>', 'sample', 3); |
48 testIt('a<br><br><br>b|', 'a<br><br><br><br>', 'sample', 4); | 48 testIt('a<br><br><br>b|', 'a<br><br><br><br>', 'sample', 4); |
49 | 49 |
50 if (window.testRunner) | 50 if (window.testRunner) |
51 $('container').outerHTML = ''; | 51 $('container').outerHTML = ''; |
52 </script> | 52 </script> |
OLD | NEW |