Skip to content
Permalink
Browse files
Fixes #11264 or rather seriously limits the risk of global ajaxSettin…
…gs screwing with script loading in domManip. Gotta love globals and sneaky dependencies. Unit test added.
  • Loading branch information
jaubourg committed Mar 7, 2012
1 parent 484cea1 commit d3fad51cad1f71bd20beba81b51552295721a5a5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
@@ -351,6 +351,8 @@ jQuery.fn.extend({
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
type: "GET",
global: false,
url: elem.src,
async: false,
dataType: "script"
@@ -0,0 +1 @@
ok( "<?php echo $_SERVER['REQUEST_METHOD'] ?>" === "GET", "request method is <?php echo $_SERVER['REQUEST_METHOD'] ?>" );
@@ -2336,6 +2336,26 @@ test( "jQuery.ajax - loading binary data shouldn't throw an exception in IE (#11
});
});

test( "jQuery.domManip - no side effect because of ajaxSetup or global events (#11264)", function() {
expect( 1 );

jQuery.ajaxSetup({
type: "POST"
});

jQuery( document ).bind( "ajaxStart ajaxStop", function() {
ok( false, "Global event triggered" );
});

jQuery( "#qunit-fixture" ).append( "<script src='data/evalScript.php'></script>" );

jQuery( document ).unbind( "ajaxStart ajaxStop" );

jQuery.ajaxSetup({
type: "GET"
});
});

test("jQuery.ajax - active counter", function() {
ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
});

0 comments on commit d3fad51

Please sign in to comment.