This must be a recent bug. When I try this example with my slightly modified version of 1.0, the first two example hold their selected values. (the third test doesn't work at all. I assume that this is because of a bug that has been fixed.) When I use 1.02, the first two break as you have noted.
Is there a place that 1.0 and 1.01 can be downloaded? (I don't have the ability to get it from SVN) These older versions could provide clues as to an easy fix.
----- Original Message -----
Sent: Tuesday, October 17, 2006 6:41 PM
Subject: [jQuery] Radio button bug

I've found a rather tricky bug in jQuery 1.0.2. When you use an 
animated slideDown() or show() on an element containing one or more 
radio buttons, the radio buttons lose their selection status in 
Firefox (1.5 and 2.0 for sure, maybe others), and Opera 9 (maybe 
others). It works fine in IE6 and Safari 2. This also only seems to 
happen when you apply an animation for the first time.

I have attached a minimal test case to reproduce. There are four 
pairs of radiobuttons, each having one radio button selected. Their 
source markup is functionally identical. Clicking the provided link 
runs a different animation on each radio button pair: the first two 
pairs of radio buttons lose their selection, the last two work fine.

This is caused by the code in jQuery.css() used to measure the 
dimensions of elements that are hidden. jQuery temporarily replicates 
the element inside its parent. This causes two selected radio buttons 
with the same 'name' to appear in the form, which is not allowed. It 
seems that Firefox and Opera defensively remove both selections in 
this case.

One fix is to simply remove the checked attributes of all radio 
buttons inside the clone, before inserting it into the parent. See 
attached patch.

This is a major blocker for jQuery in Drupal by the way, as it can 
break any animated portion of a form. I'm going to patch our included 
copy after you guys review this patch (we have a release candidate 
coming up next monday), but it would be nice to see this fixed in a 
1.0.3 release soon ;).

Steven Wittens




_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to