button-submit-remove-children.html (1206B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org"> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-2"> 5 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <iframe name=frame1 id=frame1></iframe> 10 <form id=form1 target=frame1 action="does_not_exist.html"> 11 <button id=submitbutton type=submit> 12 <span id=outerchild> 13 <span id=innerchild>submit</span> 14 </span> 15 </button> 16 </form> 17 18 <script> 19 async_test(t => { 20 window.addEventListener('load', () => { 21 const frame1 = document.getElementById('frame1'); 22 frame1.addEventListener('load', t.step_func_done(() => {})); 23 24 const submitButton = document.getElementById('submitbutton'); 25 submitButton.addEventListener('click', event => { 26 document.getElementById('outerchild').remove(); 27 }); 28 29 document.getElementById('innerchild').click(); 30 }); 31 }, 'This test will pass if a form navigation successfully occurs when clicking a child element of a <button type=submit> element with a onclick event handler which removes the button\'s child.'); 32 </script>