blob: 165cbbd42a31cb61e4182e8a89c6344e814fd55e [file] [log] [blame]
<!DOCTYPE html>
<html id='html'>
<head>
<!-- It is a minimized testcase of fuzz test. See crbug.com/343037 -->
<script>
if (window.testRunner)
testRunner.dumpAsText();
window.onload = function() {
var selection = window.getSelection();
document.execCommand('SelectAll');
selection.collapseToEnd();
// Shuffling and htmlElement.innerHTML = '' cause that nested table element does not have renderer in the selection.
var range = selection.getRangeAt(0);
range.insertNode(document.getElementById('nested_table'));
range.surroundContents(document.getElementById('caption'));
document.getElementById('table').insertAdjacentHTML('beforebegin', '<div id="target"></div>');
range.surroundContents(document.getElementById('target'));
selection.extend(document.getElementById('target'), 0);
var htmlElement = document.getElementById('html');
htmlElement.innerHTML = '';
htmlElement.parentNode.replaceChild(document.createElement('div'), htmlElement);
document.getElementsByTagName('div')[0].innerText = 'This test passes if it does not crash.';
};
</script>
</head>
<body>
<table id='table'>
<caption id='caption'>
<table id='nested_table'></table>
</caption>
</table>
</body>
</html>