OLD | NEW |
1 <!doctype HTML> | 1 <!doctype HTML> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <style> | 4 <style> |
5 div { | 5 #editable p { |
6 border: 1px solid gray; | 6 font-size: 20px; |
7 padding: 10px; | 7 line-height: 22px; |
8 line-height: 1.44; | 8 color: red; |
9 } | 9 } |
10 </style> | 10 </style> |
11 <div contenteditable="true" id="editable"> | 11 <div contenteditable="true" id="editable"> |
12 <p>This is the first paragraph.</p> | 12 <ul> |
13 <p>This is the second.</p> | 13 <li>list item 1</li> |
| 14 <li>list item 2</li> |
| 15 <li>list item 3</li> |
| 16 </ul> |
| 17 <p>Paragraph</p> |
14 </div> | 18 </div> |
15 <script> | 19 <script> |
16 test(function() { | 20 test(function() { |
17 var editor = document.getElementById('editable'); | 21 var editor = document.getElementById('editable'); |
18 var range = document.createRange(); | 22 var range = document.createRange(); |
19 var selection = window.getSelection(); | 23 var selection = window.getSelection(); |
20 range.setStart(editor.childNodes[2], 0); | 24 range.setStart(editor.childNodes[2], 0); |
21 range.collapse(true); | 25 range.collapse(true); |
22 selection.removeAllRanges(); | 26 selection.removeAllRanges(); |
23 selection.addRange(range); | 27 selection.addRange(range); |
24 editor.focus(); | 28 editor.focus(); |
25 document.execCommand('delete', null, false); | 29 document.execCommand('delete'); |
26 | 30 |
27 var html_para = document.getElementsByTagName('p')[0].outerHTML; | 31 var htmlPara = document.getElementsByTagName('li')[2].outerHTML; |
28 assert_equals(html_para, '<p>This is the first paragraph.This is the second.</
p>'); | 32 assert_equals(htmlPara, '<li>list item 3Paragraph</li>'); |
29 }, 'merge two paragraphs by backspace'); | 33 }, 'make a paragraph into a list by backspace'); |
30 </script> | 34 </script> |
OLD | NEW |