| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <div contenteditable id="root" class="editing"> | 4 <div contenteditable id="root" class="editing"> |
| 5 <span id="sample">foo</span><span id="start" style="display: none;">bar</span> b
az | 5 <span id="sample">foo</span><span id="start" style="display: none;">bar</span> b
az |
| 6 </div> | 6 </div> |
| 7 <div id="log"></div> | 7 <div id="log"></div> |
| 8 <script> | 8 <script> |
| 9 test(function() { | 9 test(function() { |
| 10 var selection = window.getSelection(); | 10 var selection = window.getSelection(); |
| 11 var sample = document.getElementById('sample'); | 11 var sample = document.getElementById('sample'); |
| 12 | 12 |
| 13 selection.collapse(document.getElementById('start').firstChild, 2); | 13 selection.collapse(document.getElementById('start').firstChild, 2); |
| 14 | 14 |
| 15 assert_true(selection.isCollapsed, 'isCollapsed'); | 15 assert_true(selection.isCollapsed, 'isCollapsed'); |
| 16 assert_equals(selection.anchorNode, sample.lastChild, 'anchorNode'); | 16 assert_equals(selection.anchorNode, document.getElementById('start').firstCh
ild, 'DOM anchorNode'); |
| 17 assert_equals(selection.anchorOffset, 3, 'anchorOffset'); | 17 assert_equals(selection.anchorOffset, 2, 'DOM anchorOffset'); |
| 18 assert_exists(window, 'internals'); |
| 19 assert_equals(internals.visibleSelectionAnchorNode, sample.lastChild, 'Canon
icalized anchorNode'); |
| 20 assert_equals(internals.visibleSelectionAnchorOffset, 3, 'Canoincalized anch
orOffset'); |
| 18 }); | 21 }); |
| 19 </script> | 22 </script> |
| OLD | NEW |