rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnocache = /<(?:script|object|embed|option|style)/i,
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
- raction = /\=([^="'>\s]+\/)>/g,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
++ rscriptType = /\/(java|ecma)script/i,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
} 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] );
}
}
var testHtml = function(valueObj) {
-- expect(31);
++ expect(34);
jQuery.scriptorder = 0;
QUnit.reset();
- jQuery("#main").html(valueObj('<script type="something/else">ok( false, "Non-script evaluated." );</script><script type="text/javascript">ok( true, "text/javascript is evaluated." );</script><script>ok( true, "No type is evaluated." );</script><div><script type="text/javascript">ok( true, "Inner text/javascript is evaluated." );</script><script>ok( true, "Inner No type is evaluated." );</script><script type="something/else">ok( false, "Non-script evaluated." );</script></div>'));
+ jQuery("#main").html(valueObj("<script type='something/else'>ok( false, 'Non-script evaluated.' );</script><script type='text/javascript'>ok( true, 'text/javascript is evaluated.' );</script><script>ok( true, 'No type is evaluated.' );</script><div><script type='text/javascript'>ok( true, 'Inner text/javascript is evaluated.' );</script><script>ok( true, 'Inner No type is evaluated.' );</script><script type='something/else'>ok( false, 'Non-script evaluated.' );</script></div>"));
+
++ 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("<script>ok( true, 'Test repeated injection of script.' );</script>"));
jQuery("#main").html(valueObj("<script>ok( true, 'Test repeated injection of script.' );</script>"));
jQuery("#main").html(valueObj("<script>ok( true, 'Test repeated injection of script.' );</script>"));
test("html(Function)", function() {
testHtml(functionReturningObj);
-- expect(33);
++ expect(36);
QUnit.reset();