From bed759c95ca6d796125653b540e8611dc63b38bb Mon Sep 17 00:00:00 2001 From: Michael Monteleone Date: Mon, 25 Jan 2010 18:43:33 -0500 Subject: [PATCH] Make sure that checked state is cloned properly. Based upon the patch by Michael, required better test cases and in doing so found more edge cases. Introduced a new check into jQuery.support as a result. Fixes #5929. --- src/manipulation.js | 15 ++++++++++++--- src/support.js | 11 ++++++++++- test/unit/manipulation.js | 20 +++++++++++++++++++- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/manipulation.js b/src/manipulation.js index 23463d1..4d0ffd0 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -5,6 +5,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rtagName = /<([\w:]+)/, rtbody = /buga')); equals( result.text(), defaultText + 'buga', 'Check if text appending works' ); @@ -230,6 +230,24 @@ var testAppend = function(valueObj) { ok( jQuery("#sap").append(valueObj( [] )), "Check for appending an empty array." ); ok( jQuery("#sap").append(valueObj( "" )), "Check for appending an empty string." ); ok( jQuery("#sap").append(valueObj( document.getElementsByTagName("foo") )), "Check for appending an empty nodelist." ); + + reset(); + jQuery("form").append(valueObj('')); + jQuery("form input[name=radiotest]").each(function(){ + ok( jQuery(this).is(':checked'), "Append checked radio"); + }).remove(); + + reset(); + jQuery("form").append(valueObj('')); + jQuery("form input[name=radiotest]").each(function(){ + ok( jQuery(this).is(':checked'), "Append alternately formated checked radio"); + }).remove(); + + reset(); + jQuery("form").append(valueObj('')); + jQuery("form input[name=radiotest]").each(function(){ + ok( jQuery(this).is(':checked'), "Append HTML5-formated checked radio"); + }).remove(); reset(); jQuery("#sap").append(valueObj( document.getElementById('form') )); -- 1.7.10.4