Last Comment Bug 377815 - radio button group's selected index changes on page reload when adding other inputs dynamically via JS
: radio button group's selected index changes on page reload when adding other ...
Status: RESOLVED DUPLICATE of bug 311507
:
Product: Core
Classification: Components
Component: Document Navigation (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-17 16:01 PDT by mdawaffe
Modified: 2008-07-31 02:49 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
HTML test case (2.34 KB, application/xhtml+xml)
2007-04-17 16:03 PDT, mdawaffe
no flags Details
testcase (2.03 KB, text/html)
2007-04-17 16:49 PDT, Martijn Wargers [:mwargers] (not working for Mozilla)
no flags Details
testcase (2.03 KB, text/html)
2007-04-17 16:51 PDT, Martijn Wargers [:mwargers] (not working for Mozilla)
no flags Details
ok, this one should really work online (1.36 KB, text/html)
2007-04-17 16:56 PDT, Martijn Wargers [:mwargers] (not working for Mozilla)
no flags Details
N > 1 testcase. Martijn's is much cleaner. (2.79 KB, text/html)
2007-04-17 17:17 PDT, mdawaffe
no flags Details

Description mdawaffe 2007-04-17 16:01:57 PDT
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.9a4pre) Gecko/20070417 Minefield/3.0a4pre
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.9a4pre) Gecko/20070417 Minefield/3.0a4pre

This is not a duplicated of bug 46845.

After reloading a page in which INPUT elements have been dynamically added to the page above a group of radio buttons, the selected index of those radio buttons will shift depending on the number of dynamically added INPUT elements.

Reproducible: Always

Steps to Reproduce:
See attached test case.

OR

1. Create a page with one group of radio buttons, have the first radio button be selected by default (not necessary: included for clarity). 
2. Using .innerHTML, add one other INPUT element (text, hidden, button: doesn't matter) above the radio buttons during window.onload
3. Reload the page by clicking the reload button in Firefox's toolbar.
Actual Results:  
The selected index of the radio buttons increments by one on each page reload.

Expected Results:  
The radio button that was selected before reloading the page should stay selected after reloading the page.

If you dynamically add N > 1 INPUT element above the radio buttons, the selected index of the radio button will increment by N on each page reload.

Originally reported as bug in WordPress:
http://trac.wordpress.org/ticket/3895
(see http://trac.wordpress.org/ticket/3895#comment:26)

Example test case attached.

Also reproducible on:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Comment 1 mdawaffe 2007-04-17 16:03:09 PDT
Created attachment 261876 [details]
HTML test case
Comment 2 mdawaffe 2007-04-17 16:21:12 PDT
Also reproducible on:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Comment 3 mdawaffe 2007-04-17 16:41:01 PDT
My first bug report.

The attached test case does not work if previewed here on this site because javascript is really sloppy.  It will work if you download source and try it out locally.
Comment 4 Martijn Wargers [:mwargers] (not working for Mozilla) 2007-04-17 16:49:58 PDT
Created attachment 261887 [details]
testcase

Thanks for the bug report, Mike. This is a testcase that should work online.
This indeed seems like a valid bug, but first I'm trying to find out if this isn't a duplicate of some other bug.
Comment 5 Martijn Wargers [:mwargers] (not working for Mozilla) 2007-04-17 16:51:47 PDT
Created attachment 261888 [details]
testcase

Grr, this one should work online.
Comment 6 Martijn Wargers [:mwargers] (not working for Mozilla) 2007-04-17 16:56:05 PDT
Created attachment 261891 [details]
ok, this one should really work online
Comment 7 Martijn Wargers [:mwargers] (not working for Mozilla) 2007-04-17 16:59:42 PDT
Ok, there is at least one bug that was filed earlier and is also about this issue, so I'm marking this a duplicate of that bug (but still thanks for filing the bug!).

*** This bug has been marked as a duplicate of bug 372887 ***
Comment 8 Martijn Wargers [:mwargers] (not working for Mozilla) 2007-04-17 17:05:01 PDT
Argh, sorry, not a duplicate, the testcase in that bug reacts differently in current trunk build. But still, this bug is probably related to that bug.
Comment 9 mdawaffe 2007-04-17 17:16:21 PDT
Thanks for cleaning up the testcase, Martijn.  Bug 372887 looks remarkably similar; I agree they must be related.

If you want to see the N > 1 case, I've got an attachment I'm about to upload that might work.  If it doesn't work, I'm giving up on the testcases.  Yours works perfectly on its own.

Comment 10 mdawaffe 2007-04-17 17:17:56 PDT
Created attachment 261897 [details]
N > 1 testcase.  Martijn's is much cleaner.
Comment 11 Martijn Wargers [:mwargers] (not working for Mozilla) 2007-04-17 17:24:03 PDT
Sorry, I just found a bug that really is the same.

*** This bug has been marked as a duplicate of bug 311507 ***

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