summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/execCommand/5164796.html
blob: 05c799ef7b660a5eb77634ca19bf98d3b3508e12 (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
<p>This tests CreateLink for caret selections.  A link containing the url text should be inserted.</p>
<div contenteditable="true" id="div">There should be a link between these two braces: {}</div>
<p id="console"></p>

<script>

if (window.testRunner)
    testRunner.dumpAsText();

function log(message) {
    var console = document.getElementById("console");
    var text = document.createTextNode(message);
    console.appendChild(text);
}

var div = document.getElementById("div");
var text = div.firstChild;
var selection = window.getSelection();
selection.collapse(text, text.length - 1);

document.execCommand("CreateLink", false, "http://www.apple.com/");

log(div.innerHTML);

</script>