Closed Bug 673646 Opened 13 years ago Closed 11 years ago

Form state restoration restores into the wrong inputs if inputs are dynamically added to the document

Categories

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

All
Other
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: nparian, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(2 files)

Attached file index.html
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110615151330

Steps to reproduce:

Sample code provided - multiple DOM elements are selected via document.getElementId on page load.

sometimes page needs to be reloaded to see symptoms
Chrome and ID do not have the same symptoms.



Actual results:

when page is loaded txtTesting 6-10 are filled with values that were set on txtTesting1 - 4


Expected results:

txtTesting6-10 should have the default values on load
Attached image image
screen shot image
Attachment #547877 - Attachment mime type: text/plain → text/html
I only see the issue if I refresh the page. On initial load it works correctly. If I do Ctrl+Shift+R it works correctly.
I see the problem after a reload and  Mozilla/5.0 (Windows NT 6.1; rv:8.0a1) Gecko/20110723 Firefox/8.0a1 SeaMonkey/2.5a1
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
Keywords: testcase
Product: Firefox → Core
QA Contact: general → general
Version: 5 Branch → Trunk
> multiple DOM elements are selected via document.getElementId 

Actually, no.  It's just that form state restoration is restoring into the wrong elements, looks like.  You can test this by adding autocomplete="off" to all the elements and seeing the resulting behavior.

I suspect the issue here is that the inputs are not in a form, and the google maps stuff adds inputs of its own to the document-global inputs-not-in-a-form list before the inputs in question, which messes up the state-restoration indexing.  See related discussion in bug 660549.
Depends on: 660549
Summary: code with Google maps selects multiple input elements when using document.getElementById → Form state restoration restores into the wrong inputs if inputs are dynamically added to the document
See also bug 311507, of which this is probably a duplicate.  Since I'm not 100% sure it is, leaving this open for now.
Depends on: 677430
Depends on: 737851
Blocks: 818011
The attached test case worksforme. Might have been fixed with bug 737851.
-> WORKSFORME
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: