OLD | NEW |
1 <script> | 1 <!DOCTYPE html> |
2 if (window.testRunner) | 2 <script src="../../resources/testharness.js"></script> |
3 testRunner.dumpEditingCallbacks(); | 3 <script src="../../resources/testharnessreport.js"></script> |
4 </script> | |
5 <p>This tests for a bug in createMarkup (markup for ancestors of the start of th
e selection wasn't being added to the pasteboard). You should see the same thin
g in both regions below.</p> | 4 <p>This tests for a bug in createMarkup (markup for ancestors of the start of th
e selection wasn't being added to the pasteboard). You should see the same thin
g in both regions below.</p> |
6 <p><b>This demonstrates a bug: 'foo' is pulled out of its bordered block.</b></p
> | 5 <p><b>This demonstrates a bug: 'foo' is pulled out of its bordered block.</b></p
> |
7 <div id="copy" contenteditable="true"><div style="margin: 5px; border: 1px solid
red;">foo<div style="margin: 5px; border: 1px solid blue;">bar</div></div>baz</
div> | 6 <div id="copy" contenteditable="true"><div style="margin: 5px; border: 1px solid
red;">foo<div style="margin: 5px; border: 1px solid blue;">bar</div></div>baz</
div> |
8 | 7 |
9 <div id="paste" contenteditable="true"></div> | 8 <div id="sample" contenteditable="true"></div> |
| 9 <div id="log"></div> |
| 10 <script> |
| 11 test(function() { |
| 12 var selection = window.getSelection(); |
| 13 selection.collapse(document.getElementById('copy')); |
| 14 document.execCommand('SelectAll'); |
| 15 document.execCommand('Copy'); |
| 16 var sample = document.getElementById('sample'); |
| 17 selection.collapse(sample); |
| 18 document.execCommand('Paste'); |
10 | 19 |
11 <script> | 20 assert_equals(sample.innerHTML, '<div style="margin: 5px; border: 1px solid
red;">foo<div style="margin: 5px; border: 1px solid blue;">bar</div></div>baz'); |
12 window.getSelection().collapse(document.getElementById("copy")); | 21 assert_true(selection.isCollapsed); |
13 document.execCommand("SelectAll"); | 22 assert_equals(selection.anchorNode, sample.lastChild); |
14 document.execCommand("Copy"); | 23 assert_equals(selection.anchorOffset, 3); |
15 window.getSelection().collapse(document.getElementById("paste")); | 24 }); |
16 document.execCommand("Paste"); | |
17 </script> | 25 </script> |
OLD | NEW |