Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../../resources/testharness.js"></script> | |
| 3 <script src="../../../resources/testharnessreport.js"></script> | |
| 4 <style> | |
| 5 div:not(#ce) { | |
| 6 display: inline-block; | |
| 7 } | |
| 8 .ico::before { | |
| 9 content: "a"; | |
| 10 } | |
| 11 </style> | |
| 12 | |
| 13 <div> | |
| 14 <div class="ico"> | |
| 15 </div><!-- | |
| 16 If you remove this comment and keep the 2 div.ico on separate lines, the selec tion works | |
| 17 fine, but their spacing is off since they are inline-block divs | |
| 18 --><div class="ico"> | |
| 19 </div> | |
| 20 </div> | |
| 21 <div id="ce" contenteditable="true"> | |
| 22 This text should be selected after the test ran. | |
| 23 </div> | |
| 24 | |
| 25 <script> | |
| 26 test(function () { | |
|
yosin_UTC9
2016/11/30 01:48:40
Could you use |assert_selection()| for easier to r
| |
| 27 let range = document.createRange(); | |
| 28 range.selectNodeContents(ce); | |
| 29 window.getSelection().addRange(range); | |
| 30 document.execCommand('FormatBlock', false, 'h1'); | |
| 31 let selectionAfterFormatBlock = window.getSelection().getRangeAt(0); | |
| 32 assert_false(selectionAfterFormatBlock.collapsed, 'The selection should not be collapsed'); | |
| 33 }, 'The selection must remain after execCommand("FormatBlock")'); | |
| 34 </script> | |
| OLD | NEW |