Closed Bug 279641 Opened 20 years ago Closed 20 years ago

The innerHTML property does not serialize the current value of form elements within the parent element

Categories

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

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 159282

People

(Reporter: richardtallent, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/0.6

If an element contains form elements within it, the element's innerHTML property
shows the form element's *default* value rather than their *current* value.
Thus, if the innerHTML property is modified (to, say, add an additional form
element dynamically), all contained form elements are reset to their default
values or states.

Reproducible: Always

Steps to Reproduce:
1. Enter into the address bar: javascript:document.write('<form><div
id="test"><input type="text"></div></form>');
2. Modify the value of the newly-created input field.
3. Enter into the address bar:
javascript:document.getElementById("test").innerHTML += 'more content';
Actual Results:  
The <div>'s content is appended, but the contained form element is reset because
the <div>'s innerHTML property did not preserve the value from step 2.

Expected Results:  
The innerHTML property should correctly serialize the current state/value of any
form elements it contains.

I don't believe this bug exhibited in versions of Firefox earlier than 0.9 or
so. FWIW, MSIE 6.0 preserves the form element values in parent elements'
innerHTML properties.

I have not tested whether this issue affects fields that are modified by client
scripting rather than user action, but the action should be the same in either case.
Assignee: bugs → general
Component: Form Manager → DOM
Product: Firefox → Core
QA Contact: form-manager → ian
Whiteboard: DUPEME
Version: unspecified → Trunk
not a bug. see bug 159282

*** This bug has been marked as a duplicate of 159282 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.