summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/pasteboard/paste-visible-script.html
blob: fe27476894e21d9cfd7ef04699b5c78cd3ef42c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<body>
<div id="test1" >
Hello
<script style="display: block">
function sayHello()
{
    alert("Hello");
}
</script>
<script>
function foo() {
    var i = 10;
    if (i >= 10)
        alert('foo');
}
</script>
<script style="display: block" src="../editing.js">
</script>
<div id="test2">
World
</div>
<div id="pastehere" contenteditable="true"></div>
<ul id="console"></ul>
<script>
if (window.testRunner)
     testRunner.dumpAsText();

var s = window.getSelection();
var p1 = document.getElementById("test1");
s.collapse(p1, 0);
s.setBaseAndExtent(p1, 0, document.getElementById("test2"), 2);
document.execCommand("Copy");
p1 = document.getElementById("pastehere");
s.collapse(p1, 0);
document.execCommand("Paste");

log(document.getElementById("pastehere").outerHTML);

function log(str) {
    var li = document.createElement("li");
    li.appendChild(document.createTextNode(str));
    var console = document.getElementById("console");
    console.appendChild(li);
}
</script>
</body>