From: John Resig Date: Tue, 12 Apr 2011 20:39:30 +0000 (-0400) Subject: Merge branch 'master' of https://github.com/rjgotten/jquery into rjgotten-master... X-Git-Tag: 1.6b1~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3418f323876043db63a2da9f653e51d5458647fa;p=jquery.git Merge branch 'master' of https://github.com/rjgotten/jquery into rjgotten-master. Also added in unit tests covering the case. Fixes #6180. Conflicts: src/manipulation.js --- 3418f323876043db63a2da9f653e51d5458647fa diff --cc src/manipulation.js index 758cdbae0,2cd95ce95..52d59d83e --- a/src/manipulation.js +++ b/src/manipulation.js @@@ -7,8 -7,8 +7,9 @@@ var rinlinejQuery = / jQuery\d+="(?:\d+ rtbody = /\s]+\/)>/g, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, ++ rscriptType = /\/(java|ecma)script/i, wrapMap = { option: [ 1, "" ], legend: [ 1, "
", "
" ], @@@ -635,7 -531,9 +636,11 @@@ jQuery.extend( } else { if ( ret[i].nodeType === 1 ) { - ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); - var jsTags = jQuery.makeArray( ret[i].getElementsByTagName( "script" )), - jsTags = jQuery.grep(jsTags, function(n, i) { return ( !n.type || n.type.toLowerCase() === "text/javascript" ) }); - ret.splice.apply( ret, [i + 1, 0].concat( jsTags )); ++ var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), function( elem ) { ++ return !elem.type || rscriptType.test( elem.type ); ++ }); ++ ++ ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); } fragment.appendChild( ret[i] ); } diff --cc test/unit/manipulation.js index 64265c9b5,d4c434871..de65daa13 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@@ -1058,7 -892,7 +1058,7 @@@ test("clone() on XML nodes", function( } var testHtml = function(valueObj) { -- expect(31); ++ expect(34); jQuery.scriptorder = 0; @@@ -1113,8 -947,8 +1113,14 @@@ QUnit.reset(); - jQuery("#main").html(valueObj('
')); + jQuery("#main").html(valueObj("
")); + ++ var child = jQuery("#main").find("script"); ++ ++ equals( child.length, 2, "Make sure that two non-JavaScript script tags are left." ); ++ equals( child[0].type, "something/else", "Verify type of script tag." ); ++ equals( child[1].type, "something/else", "Verify type of script tag." ); + jQuery("#main").html(valueObj("")); jQuery("#main").html(valueObj("")); jQuery("#main").html(valueObj("")); @@@ -1133,7 -967,7 +1139,7 @@@ test("html(String)", function() test("html(Function)", function() { testHtml(functionReturningObj); -- expect(33); ++ expect(36); QUnit.reset();