blob: c1d1b5c61b50ce2b95cfc88bc02f185bfdf177c5 [file] [log] [blame]
<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.setPosition(text, text.length - 1);
document.execCommand("CreateLink", false, "http://www.apple.com/");
log(div.innerHTML);
</script>