OLD | NEW |
---|---|
1 <html> | 1 <!doctype html> |
2 <head> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <script src="../assert_selection.js"></script> | |
5 <script> | |
6 test(() => { | |
7 assert_not_equals(window.internals, undefined, | |
8 'This test requires window.internals to access clipboard'); | |
3 | 9 |
4 <style> | 10 assert_selection( |
5 .editing { | 11 [ |
6 border: 2px solid red; | 12 '<div contenteditable>', |
7 font-size: 24px; | 13 '<div>', |
8 } | 14 '<div>', |
9 .explanation { | 15 '^abcdef', |
10 border: 2px solid blue; | 16 '<div style="text-align: center;">', |
11 padding: 12px; | 17 '<table><tr><td>foo</td><td>bar</td></tr></table>', |
12 font-size: 24px; | 18 '</div>', |
Xiaocheng
2016/09/26 09:13:36
This <div> also contains |ghijk| in the original t
yosin_UTC9
2016/09/26 10:05:15
Done.
| |
13 margin-bottom: 24px; | 19 'ghijk|', |
14 } | 20 '</div>', |
15 .scenario { margin-bottom: 16px;} | 21 '</div>', |
16 .scenario:first-line { font-weight: bold; margin-bottom: 16px;} | 22 '</div>', |
17 .expected-results:first-line { font-weight: bold } | 23 ].join(''), |
18 </style> | 24 selection => { |
19 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script > | 25 selection.document.execCommand('copy'); |
20 | 26 selection.document.execCommand('delete'); |
21 <script> | 27 selection.document.execCommand('paste'); |
22 function log(message) { | 28 }, |
23 var console = document.getElementById("console"); | 29 [ |
24 var li = document.createElement("li"); | 30 '<div contenteditable>', |
25 var text = document.createTextNode(message); | 31 'abcdef', |
26 li.appendChild(text); | 32 '<div style="text-align: center;">', |
27 console.appendChild(li); | 33 '<table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></ta ble>', |
28 } | 34 '</div>', |
29 | 35 'ghijk|', |
30 function editingTest() { | 36 '</div>', |
31 execSelectAllCommand(); | 37 ].join('')); |
32 copyCommand(); | 38 }); |
33 execDeleteCommand(); | |
34 pasteCommand(); | |
35 } | |
36 | |
37 </script> | 39 </script> |
38 | |
39 <title>Editing Test</title> | |
40 </head> | |
41 <body> | |
42 Problem: copy/pasting some HTML including tables can give rise to a <div> element as the first child of the table element. This is invalid. | |
43 <div contenteditable id="root"> | |
44 <div id="test" class="editing"> | |
45 <div> | |
46 abcdef | |
47 <div style="text-align: center" > | |
48 <table><tr><td>foo</td><td>bar</td></tr></table> | |
49 ghijk | |
50 </div> | |
51 </div> | |
52 </div> | |
53 </div> | |
54 | |
55 <ol id="console" /> | |
56 | |
57 <script> | |
58 runEditingTest(); | |
59 log(root.innerHTML); | |
60 if (window.testRunner) | |
61 testRunner.dumpAsText(); | |
62 </script> | |
63 | |
64 </body> | |
65 </html> | |
OLD | NEW |