| 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 <style> | 4 <style> |
| 5 table, td { | 5 table, td { |
| 6 border: 1px solid #999; | 6 border: 1px solid #999; |
| 7 } | 7 } |
| 8 </style> | 8 </style> |
| 9 <div id="log"></div> | 9 <div id="log"></div> |
| 10 <p>This tests the caret position for the caret after an inline table.</p> | 10 <p>This tests the caret position for the caret after an inline table.</p> |
| 11 <div id="div" contenteditable="true">foo<table style="display:inline-table" id="
sample"><tr><td>this</td></tr><tr><td>is</td></tr><tr><td>a table</td></tr></tab
le>baz</div> | 11 <div id="div" contenteditable="true">foo<table style="display:inline-table" id="
sample"><tr><td>this</td></tr><tr><td>is</td></tr><tr><td>a table</td></tr></tab
le>baz</div> |
| 12 <script> | 12 <script> |
| 13 test(function () { | 13 test(function () { |
| 14 var selection = window.getSelection(); | 14 var selection = window.getSelection(); |
| 15 selection.collapse(sample, sample.childNodes.length); | 15 let childLength = sample.childNodes.length; |
| 16 selection.collapse(sample, childLength); |
| 16 assert_true(selection.isCollapsed, 'isCollapsed'); | 17 assert_true(selection.isCollapsed, 'isCollapsed'); |
| 17 assert_equals(selection.anchorNode, div, 'anchorNode'); | 18 |
| 18 assert_equals(selection.anchorOffset, 2, 'anchorOffset'); | 19 assert_equals(selection.anchorNode, sample, 'DOM anchorNode'); |
| 20 assert_equals(selection.anchorOffset, childLength, 'DOM anchorOffset'); |
| 21 assert_exists(window, 'internals'); |
| 22 assert_equals(internals.visibleSelectionAnchorNode, div, 'Canonicalized anch
orNode'); |
| 23 assert_equals(internals.visibleSelectionAnchorOffset, 2, 'Canonicalized anch
orOffset'); |
| 19 }); | 24 }); |
| 20 </script> | 25 </script> |
| OLD | NEW |