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.
This commit is contained in:
Sindre Sorhus 2012-02-09 15:45:34 +01:00 committed by Dave Methvin
parent 2803a5e6f2
commit 92cd999097
2 changed files with 11 additions and 1 deletions

View File

@ -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 );

View File

@ -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" );
@ -317,6 +317,12 @@ var testAppend = function(valueObj) {
ok( jQuery(this).is(":checked"), "Append HTML5-formated checked radio");
}).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