Closed Bug 551418 Opened 16 years ago Closed 11 years ago

javascript innerHTML toggles radio button on page reload

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: webdev, Unassigned)

References

Details

(Whiteboard: DUPEME)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8 FirePHP/0.4 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8 Reloading an HTML page which uses javascript to change the innerHTML of an element causes a radio button set to toggle every time the page is loaded if, and only if, the innerHTML value contains form elements and the radio buttons appear after the page element that is being rewritten. This has been reproduced with Firefox 3.5.8 and 3.7a3pre running on Ubuntu/9.10, and also with Firefox 3.6 running on MAC OSX. (Not tested on any other OS) Reproducible: Always Steps to Reproduce: 1. Open a page such as that given in 'additional information'. 2. Hit the reload button 3. Keep hitting the reload button Actual Results: The radio button selection is toggled on each page load. Expected Results: The radio button should not toggle. The following simple HTML page can be used to reproduce the problem: --------8<----------8<-----------------8<------------ <html> <head> <title>FF Radio Bug</title> </head> <body> <form method="post" action="index.php"> <span id="write-sort"></span> <span> <input type="radio" name="Annotate" value="0" checked="checked" />Off <input type="radio" name="Annotate" value="1" />On </span> </form> <script language="javascript" type="text/javascript"> side = document.getElementById('write-sort'); side.innerHTML = '<textarea>'; </script> </body> </html> -------->8---------->8----------------->8------------
This bug exists on Windoze, OSX and Linux
Component: General → JavaScript Engine
Product: Firefox → Core
Assignee: nobody → general
QA Contact: general → general
Duplicate of the general bug on form control state restoration restoring to the wrong control if the set of controls is changed via the DOM.
Whiteboard: DUPEME
(In reply to comment #3) > Duplicate of the general bug on form control state restoration restoring to the > wrong control if the set of controls is changed via the DOM. What's the bug ID?
Assignee: general → nobody
I can't confirm the toggling in FF36.0.4/Win7 - under similar conditions as described above. Using page refresh (F5), (mandatory) radio buttons remain unchecked. Using the submit button while mandatory fields haven't been filled, thus causing a page refresh, one radio button of each radio button group gets checked, although it hadn't been checked before submitting the form. Opera, Chrome, IE and Safari - current versions - don't show this (mis)behavior.
> I can't confirm the toggling in FF36.0.4/Win7 - under similar conditions as described > above. Yep, this got fixed in bug 737851. The rest of comment 5 seems to be about a different bug than this one, which should be filed separately.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Depends on: 737851
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: