<!DOCTYPE html>
<html>
<head>
<style type="text/css">
table, td { border: solid 2px red; border-collapse: collapse; }
</style>
</head>
<body>
<p id="description">This tests moving to line boundaries in the first or the last table cell, and types "h" and "d" respectively.
You should see "hello" and "world" in the first and the second table cell respectively.</p>
<div id="container" contentEditable="true">a<table><tr><td id="target">ello</td><td>worl</td></tr></table>b</div>
<script>

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

var target = document.getElementById('target');
getSelection().collapse(target.firstChild, 2);
getSelection().modify('Move', 'Backward', 'LineBoundary');
document.execCommand('InsertText', false, 'h');

getSelection().collapse(target.nextSibling.firstChild, 2);
getSelection().modify('Move', 'Forward', 'LineBoundary');
document.execCommand('InsertText', false, 'd');

document.writeln(target.parentNode.textContent == 'helloworld' ? 'PASS' : 'FAIL');
if (window.testRunner)
    document.getElementById('container').style.display = 'none';

</script>
</body>
</html>
