<!DOCTYPE html> <style> table { display: none; } </style> <script src="../../resources/js-test.js"></script> <table id="table1"> <form> <td><input></td> </form> </table> <table id="table2"> <form> <td><input></td> </form> </table> <script> description('Form controls associated with a form by the parser should be reset when that form leaves their tree.'); debug('Removing a form from the document while leaving its associated element in...'); document.forms[0].parentNode.removeChild(document.forms[0]); shouldBeNull('document.querySelector("input").form'); debug(''); debug('Removing a form and its associated element...'); var table2 = document.getElementById('table2'); table2.parentNode.removeChild(table2); shouldBeNonNull('table2.querySelector("input").form'); debug('...and then removing the form.'); table2.removeChild(table2.querySelector('form')); shouldBeNull('table2.querySelector("input").form'); </script>