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 selection should be the same before and aft
er the 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 selection should be the same before and aft
er the 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"); |
| 15 selection.modify("extend", "forward", "character"); |
7 | 16 |
8 sel.collapse(div, 0); | 17 document.execCommand("JustifyCenter"); |
9 sel.modify("move", "forward", "paragraphBoundary"); | |
10 sel.modify("move", "forward", "character"); | |
11 sel.modify("extend", "forward", "character"); | |
12 | 18 |
13 document.execCommand("JustifyCenter"); | 19 assert_equals(div.innerHTML, 'foo<br><div style="text-align: center;"><img s
rc="../resources/abe.png"></div>baz'); |
| 20 assert_equals(selection.anchorNode, div.childNodes[2]); |
| 21 assert_equals(selection.anchorOffset, 0); |
| 22 assert_equals(selection.focusNode, div.childNodes[2]); |
| 23 assert_equals(selection.focusOffset, 1); |
| 24 }); |
14 </script> | 25 </script> |
OLD | NEW |