Skip to content

Commit

Permalink
Revert "Fix #12127. IE9/10 checks fall off the box on clone. Close jq…
Browse files Browse the repository at this point in the history
…uerygh-873."

This reverts commit 569d064.

Causing test fails in Safari, IE6, and IE7.
  • Loading branch information
dmethvin committed Jul 25, 2012
1 parent 1d5d0d8 commit 98df267
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
1 change: 0 additions & 1 deletion AUTHORS.txt
Expand Up @@ -129,4 +129,3 @@ David Benjamin <davidben@mit.edu>
Uri Gilad <antishok@gmail.com>
Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@googlemail.com>
4 changes: 3 additions & 1 deletion src/manipulation.js
Expand Up @@ -455,7 +455,9 @@ function cloneFixAttributes( src, dest ) {
// 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
dest.defaultChecked = dest.checked = src.checked;
if ( 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"
Expand Down
6 changes: 3 additions & 3 deletions src/support.js
Expand Up @@ -15,7 +15,7 @@ jQuery.support = (function() {

// Preliminary tests
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox' checked='checked'/>";
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";

all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
Expand Down Expand Up @@ -96,8 +96,8 @@ jQuery.support = (function() {
};

// Make sure checked status is properly cloned
input.checked = false;
support.noCloneChecked = !input.cloneNode( true ).checked;
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;

// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
Expand Down
11 changes: 0 additions & 11 deletions test/unit/manipulation.js
Expand Up @@ -1895,14 +1895,3 @@ test("html() - script exceptions bubble (#11743)", function() {
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' );
});

0 comments on commit 98df267

Please sign in to comment.