Uri Gilad <antishok@gmail.com>
Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
+Daniel Chatfield <chatfielddaniel@googlemail.com>
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
- if ( src.checked ) {
- dest.defaultChecked = dest.checked = src.checked;
- }
+
+ dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
ok( false, "error ignored" );
}, "exception bubbled from remote script" );
});
+
+test("checked state is cloned with clone()", function(){
+ expect(2);
+
+ var elem = jQuery.parseHTML("<input type='checkbox' checked='checked'/>")[0];
+ elem.checked = false;
+ equal( jQuery(elem).clone().attr("id","clone")[0].checked, false, "Checked false state correctly cloned" );
+
+ elem = jQuery.parseHTML("<input type='checkbox'/>")[0];
+ elem.checked = true;
+ equal( jQuery(elem).clone().attr("id","clone")[0].checked, true, "Checked true state correctly cloned" );
+});