diff options
author | Sindre Sorhus <sindresorhus@gmail.com> | 2012-02-09 15:45:34 +0100 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-03-02 13:55:58 -0500 |
commit | 92cd9990971a097b6639607b0d1172e9fe6d0dca (patch) | |
tree | b17c404f9020cddba20b5a9997d815364738314f | |
parent | 2803a5e6f2704691fdd8ce4d34fe961d0192a0fb (diff) | |
download | jquery-92cd9990971a097b6639607b0d1172e9fe6d0dca.tar.gz jquery-92cd9990971a097b6639607b0d1172e9fe6d0dca.zip |
Fix #11217. WebKit clone() loses check if name follows checked attribute.
Please folks, hold your questions. We don't explain em, we just fix em.
-rw-r--r-- | src/support.js | 4 | ||||
-rw-r--r-- | test/unit/manipulation.js | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/support.js b/src/support.js index 27ef1ab4c..3b64a49be 100644 --- a/src/support.js +++ b/src/support.js @@ -131,6 +131,10 @@ jQuery.support = (function() { support.radioValue = input.value === "t"; input.setAttribute("checked", "checked"); + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "name", "t" ); + div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.lastChild ); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 717488178..bfdc1551a 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -265,7 +265,7 @@ test("unwrap()", function() { }); var testAppend = function(valueObj) { - expect(41); + expect(46); var defaultText = "Try them out:" var result = jQuery("#first").append(valueObj("<b>buga</b>")); equal( result.text(), defaultText + "buga", "Check if text appending works" ); @@ -318,6 +318,12 @@ var testAppend = function(valueObj) { }).remove(); QUnit.reset(); + jQuery("form").append(valueObj("<input type='radio' checked='checked' name='radiotest' />")); + jQuery("form input[name=radiotest]").each(function(){ + ok( jQuery(this).is(":checked"), "Append with name attribute after checked attribute"); + }).remove(); + + QUnit.reset(); jQuery("#sap").append(valueObj( document.getElementById("form") )); equal( jQuery("#sap>form").size(), 1, "Check for appending a form" ); // Bug #910 |