| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!doctype html> |
| 2 <html> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <head> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../../resources/dump-as-markup.js"></script> | 4 <script src="../assert_selection.js"></script> |
| 5 </head> | |
| 6 <body> | |
| 7 <div id="editorcontainer" contenteditable="true"> | |
| 8 Will select from here | |
| 9 <div contenteditable="false"> | |
| 10 over this contenteditable=false div | |
| 11 </div> | |
| 12 until here. | |
| 13 </div> | |
| 14 </body> | |
| 15 <script> | 5 <script> |
| 16 Markup.description('formatblock on selection with a contenteditable="false"
child.'); | 6 test(() => assert_selection( |
| 17 | 7 [ |
| 18 var selection = window.getSelection(); | 8 '<div contenteditable>', |
| 19 selection.removeAllRanges(); | 9 ' ^Will select from here', |
| 20 | 10 ' <div contenteditable="false">', |
| 21 var container = document.getElementById('editorcontainer'); | 11 ' over this contenteditable=false div', |
| 22 var range = document.createRange() | 12 ' </div>', |
| 23 range.setStartBefore(container.firstChild); | 13 ' until here.|', |
| 24 range.setEndAfter(container.lastChild); | 14 '</div>', |
| 25 selection.addRange(range); | 15 ].join('\n'), |
| 26 | 16 selection => { |
| 27 document.execCommand('italic', false, ""); | 17 selection.document.execCommand('italic'); |
| 28 document.execCommand('formatblock', false, "<h1>"); | 18 selection.document.execCommand('formatblock', false, '<h1>'); |
| 29 | 19 }, |
| 30 Markup.dump(container); | 20 [ |
| 21 '<div contenteditable><h1><i>', |
| 22 ' ^Will select from here', |
| 23 ' </i><br><i>', |
| 24 ' until here.|', |
| 25 '</i></h1><div contenteditable="false">', |
| 26 ' over this contenteditable=false div', |
| 27 ' </div></div>', |
| 28 ].join('\n')), |
| 29 'formatBlock with uneditable'); |
| 31 </script> | 30 </script> |
| 32 </html> | |
| OLD | NEW |