| <!doctype html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../assert_selection.js"></script> |
| <script> |
| test(() => assert_selection( |
| '<div contenteditable>^012<select></select>|</div><option></option>', |
| selection => { |
| const div = selection.document.querySelector('div'); |
| let currentCommand = ''; |
| function execCommand(name) { |
| currentCommand = name; |
| selection.document.execCommand(name); |
| } |
| // Move SELECT into OPTION before calling |FrameSelection::setSelection()| |
| // in |Editor::reappliedEditing()|. |
| div.addEventListener('webkitEditableContentChanged', () => { |
| if (currentCommand !== 'redo') |
| return; |
| const div = selection.document.querySelector('div'); |
| const select = selection.document.querySelector('select'); |
| const option = selection.document.querySelector('option'); |
| option.appendChild(select); |
| }); |
| execCommand('bold'); |
| execCommand('undo'); |
| execCommand('redo'); |
| }, |
| '<div contenteditable><b>^012|</b></div><option><select></select></option>'), |
| 'Redo command should update selection'); |
| </script> |