mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-13 18:37:37 +02:00
Previously, the list was copied when constructing the FormData object, then the original list was passed to the event, meaning any changes to the list that happened within the event would not be reflected outside of it. (cherry picked from commit ea0e434d1d6b464ab0a56c4b7150950be78ae7d3)
20 lines
602 B
HTML
20 lines
602 B
HTML
<!DOCTYPE html>
|
|
<form id="test-form">
|
|
<input type="text" name="field1" value="value1">
|
|
</form>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
const form = document.getElementById('test-form');
|
|
|
|
form.addEventListener('formdata', (event) => {
|
|
event.formData.append('field2', 'value2');
|
|
});
|
|
|
|
const formData = new FormData(form);
|
|
|
|
println(`formData.get('field1') === 'value1': ${formData.get('field1') === 'value1'}`);
|
|
println(`formData.get('field2') === 'value2': ${formData.get('field2') === 'value2'}`);
|
|
});
|
|
</script>
|