<!DOCTYPE html>
<html>
<body>
<p>This tests removing the datalist element immediately after changing the type of the input element's type.<br>
WebKit should not hit a debug assertion.</p>
<input id="input" list="fruits" type="checkbox">
<datalist id="fruits">
    <option>Orange</option>
    <option>Pear</option>
    <option>Apple</option>
</datalist>
<script>
if (window.testRunner)
    testRunner.dumpAsText();
input.type = 'text';
fruits.remove();
input.remove();
document.write('PASS');
</script>
</body>
</html>
