mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fixes #11264 or rather seriously limits the risk of global ajaxSettings screwing with script loading in domManip. Gotta love globals and sneaky dependencies. Unit test added.
This commit is contained in:
parent
484cea1b56
commit
d3fad51cad
@ -351,6 +351,8 @@ jQuery.fn.extend({
|
|||||||
jQuery.each( scripts, function( i, elem ) {
|
jQuery.each( scripts, function( i, elem ) {
|
||||||
if ( elem.src ) {
|
if ( elem.src ) {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
|
type: "GET",
|
||||||
|
global: false,
|
||||||
url: elem.src,
|
url: elem.src,
|
||||||
async: false,
|
async: false,
|
||||||
dataType: "script"
|
dataType: "script"
|
||||||
|
1
test/data/evalScript.php
Normal file
1
test/data/evalScript.php
Normal file
@ -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() {
|
test("jQuery.ajax - active counter", function() {
|
||||||
ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
|
ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user