Open Bug 494755 Opened 12 years ago Updated 1 year ago

JavaScript submit() stops working after removing an element from the page using JavaScript

Categories

(Core :: DOM: Core & HTML, defect)

1.9.1 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

UNCONFIRMED

People

(Reporter: pekka.laiho, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)

I have 2 javascript functions: one that calls form.submit() and one that dynamically removes one row from a table (a TR element). After removing the row, the submit() function stops working.

This was tested in FireFox 3.0.10 and 3.5b4 and seems to be broken in both. However it seems to work ok in IE6 and Google Chrome.

// submit-function:
document.getElementById("budjetti_form").submit();

// remove tr-function:
var table = document.getElementById("budjetti_table");
var row = document.getElementById(id);
table.tBodies[0].removeChild(row);

Reproducible: Always

Steps to Reproduce:
Stated in the details-section.
Actual Results:  
Submit() function stops working.

Expected Results:  
Submit() should work normally after removing an element from the page.
Component: General → HTML: Form Submission
Product: Firefox → Core
QA Contact: general → form-submission
Version: unspecified → 1.9.1 Branch
Could be related to bug 586329, but this needs a testcase to be sure.
Attaching a test case demonstrating the issue (test-case-2015-11-17.html).

Steps to reproduce:

1. Open test-case-2015-11-17.html.
2. Press “Save”. Observe form is submitted.
3. Re-open test-case-2015-11-17.html.
4. Press “Remove” to remove the button and its containing <div>.
5. Press “Save”. Observe form does not submit.

Occurs on:

- Firefox 42.0 on Mac OS X 10.10.5.
- Firefox 42.0 / Windows 7.

Does not occur on:

- Safari 9.0.1 / Mac OS X 10.10.5.
- Opera 33.0 / Mac OS X 10.10.5.
- Chrome 46.0.2490.86 / Mac OS X 10.10.5.

Additional:

- Issue does not occur when `removeIt` is called from an event handler attribute. Issue does occur when `removeIt` is called from an event listener.
- Removing the call to `evt.target.parentNode.remove()` resolves the issue.
One other note on test-case-2015-11-17.html: changing the <button>’s type attribute to “button” also resolves/works around the issue.
Thanks for the workaround Evan. I can confirm it with Firefox v53 - https://gist.github.com/robertknight/5f3832ba3300a6b6536a237382f1db81
can this bugs be solved or just we can closed it as incomplete?
Component: HTML: Form Submission → DOM: Core & HTML

I just ran into this same issue on Firefox Developer Edition, 70.0b1 on macOS 10.14.6.

You need to log in before you can comment on or make changes to this bug.