<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.setPosition(p1, 0);
s.setBaseAndExtent(p1, 0, document.getElementById("test2"), 1);
document.execCommand("Copy");
p1 = document.getElementById("pastehere");
s.setPosition(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>
