31 lines
764 B
HTML
31 lines
764 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<body>
|
|
<p>This tests cloning an input element with an edited value.
|
|
The cloned input element should retain the edited value and you should see PASSED blow.</p>
|
|
<pre id="log"></pre>
|
|
<div><input id="test" title="1" type="text" value="FAIL"></div>
|
|
<script type="text/javascript">
|
|
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
var test = document.getElementById('test');
|
|
test.value = 'PASS';
|
|
|
|
var x = test.offsetLeft; // Force layout
|
|
|
|
var clone = test.cloneNode(true);
|
|
test.parentNode.appendChild(clone);
|
|
test.value = '';
|
|
|
|
clone.focus();
|
|
clone.selectionStart = clone.selectionEnd = clone.value.length;
|
|
document.execCommand('InsertText', false, 'ED');
|
|
|
|
document.getElementById('log').textContent = clone.value;
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|