OLD | NEW |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
1 <p>This tests for a bug where changing the alignment of an image would result in
a selection that wasn't the one that was present before the alignment change.
The image should be centered and the caret should be the same before and after t
he operation.</p> | 4 <p>This tests for a bug where changing the alignment of an image would result in
a selection that wasn't the one that was present before the alignment change.
The image should be centered and the caret should be the same before and after t
he operation.</p> |
2 <div id="div" contenteditable="true">foo<br><img src="../resources/abe.png"><br>
baz</div> | 5 <div id="div" contenteditable="true">foo<br><img src="../resources/abe.png"><br>
baz</div> |
| 6 <div id="log"></div> |
| 7 <script> |
| 8 test(function() { |
| 9 var div = document.getElementById('div'); |
| 10 var selection = window.getSelection(); |
3 | 11 |
4 <script> | 12 selection.collapse(div, 0); |
5 var div = document.getElementById("div"); | 13 selection.modify('move', 'forward', 'paragraphBoundary'); |
6 var sel = window.getSelection(); | 14 selection.modify('move', 'forward', 'character'); |
7 | 15 |
8 sel.collapse(div, 0); | 16 document.execCommand('JustifyCenter'); |
9 sel.modify("move", "forward", "paragraphBoundary"); | |
10 sel.modify("move", "forward", "character"); | |
11 | 17 |
12 document.execCommand("JustifyCenter"); | 18 assert_equals(div.innerHTML, 'foo<br><div style="text-align: center;"><img s
rc="../resources/abe.png"></div>baz'); |
| 19 assert_true(selection.isCollapsed); |
| 20 assert_equals(selection.anchorNode, div.childNodes[2]); |
| 21 assert_equals(selection.anchorOffset, 0); |
| 22 }); |
13 </script> | 23 </script> |
OLD | NEW |