@@ -263,11 +263,28 @@ jQuery.extend( {

// Evaluates a script in a global context
globalEval: function( code, context ) {
context = context || document;
var script = context.createElement( "script" );
var script,
indirect = eval;

script.text = code;
context.head.appendChild( script ).parentNode.removeChild( script );
code = jQuery.trim( code );

if ( code ) {

// If the code includes a valid, prologue position
// strict mode pragma, execute code by injecting a
// script tag into the document.
if ( code.indexOf( "use strict" ) === 1 ) {
script = document.createElement( "script" );
script.text = code;
context.head.appendChild( script ).parentNode.removeChild( script );
} else {

// Otherwise, avoid the DOM node creation, insertion
// and removal by using an indirect global eval

indirect( code );
}
}
},

// Convert dashed to camelCase; used by the css and data modules
@@ -23,13 +23,6 @@ var
rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/;

function raf() {
if ( timerId ) {
window.requestAnimationFrame( raf );
jQuery.fx.tick();
}
}

// Animations created synchronously will run synchronously
function createFxNow() {
window.setTimeout( function() {
@@ -408,15 +401,9 @@ jQuery.speed = function( speed, easing, fn ) {
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};

// Go to the end state if fx are off or if document is hidden
if ( jQuery.fx.off || document.hidden ) {
opt.duration = 0;

} else {
opt.duration = typeof opt.duration === "number" ?
opt.duration : opt.duration in jQuery.fx.speeds ?
jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
}
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ?
opt.duration : opt.duration in jQuery.fx.speeds ?
jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;

// Normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
@@ -620,18 +607,12 @@ jQuery.fx.timer = function( timer ) {
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = window.requestAnimationFrame ?
window.requestAnimationFrame( raf ) :
window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};

jQuery.fx.stop = function() {
if ( window.cancelAnimationFrame ) {
window.cancelAnimationFrame( timerId );
} else {
window.clearInterval( timerId );
}
window.clearInterval( timerId );

timerId = null;
};
@@ -192,7 +192,7 @@ function domManip( collection, args, callback, ignored ) {
jQuery._evalUrl( node.src );
}
} else {
jQuery.globalEval( node.textContent.replace( rcleanScript, "" ), doc );
jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
}
}
}
File renamed without changes.
@@ -17,7 +17,7 @@
oldIE into thinking the dom is ready, but it's not...
leaving this check here for future trailblazers to attempt
fixing this...-->
<script type="text/javascript" src="../longLoadScript.php?sleep=1"></script>
<script type="text/javascript" src="longLoadScript.php?sleep=1"></script>
<div id="container" style="height: 300px"></div>
</body>
</html>

This file was deleted.

@@ -1624,9 +1624,17 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
jQuery.ajax( {
url: "data/badjson.js",
dataType: "script",
throws: true
} );
} );
throws: true,
// Global events get confused by the exception
global: false,
success: function() {
assert.ok( false, "Success." );
},
error: function() {
assert.ok( false, "Error." );
}
});
});

jQuery.each( [ "method", "type" ], function( _, globalOption ) {
function request( assert, option ) {
@@ -170,21 +170,6 @@ QUnit.test( "globalEval with 'use strict'", function( assert ) {
assert.equal( window.strictEvalTest, 1, "Test variable declarations are global (strict mode)" );
} );

QUnit.test( "globalEval execution after script injection (#7862)", function( assert ) {
assert.expect( 1 );

var now,
script = document.createElement( "script" );

script.src = "data/longLoadScript.php?sleep=2";

now = jQuery.now();
document.body.appendChild( script );

jQuery.globalEval( "var strictEvalTest = " + jQuery.now() + ";" );
assert.ok( window.strictEvalTest - now < 500, "Code executed synchronously" );
} );

// This is not run in AMD mode
if ( jQuery.noConflict ) {
QUnit.test( "noConflict", function( assert ) {
@@ -5,11 +5,8 @@ if ( !jQuery.fx ) {
return;
}

var oldRaf = window.requestAnimationFrame;

QUnit.module( "effects", {
setup: function() {
window.requestAnimationFrame = null;
this.sandbox = sinon.sandbox.create();
this.clock = this.sandbox.useFakeTimers( 505877050 );
this._oldInterval = jQuery.fx.interval;
@@ -22,7 +19,6 @@ QUnit.module( "effects", {
jQuery.now = Date.now;
jQuery.fx.stop();
jQuery.fx.interval = this._oldInterval;
window.requestAnimationFrame = oldRaf;
return moduleTeardown.apply( this, arguments );
}
} );
@@ -2317,35 +2313,6 @@ QUnit.test( "Respect display value on inline elements (#14824)", function( asser
clock.tick( 800 );
} );

QUnit.test( "Animation should go to its end state if document.hidden = true", function( assert ) {
assert.expect( 1 );

var height;
if ( Object.defineProperty ) {

// Can't rewrite document.hidden property if its host property
try {
Object.defineProperty( document, "hidden", {
get: function() {
return true;
}
} );
} catch ( e ) {}
} else {
document.hidden = true;
}

if ( document.hidden ) {
height = jQuery( "#qunit-fixture" ).animate( { height: 500 } ).height();

assert.equal( height, 500, "Animation should happen immediately if document.hidden = true" );
jQuery( document ).removeProp( "hidden" );

} else {
assert.ok( true, "Can't run the test since we can't reproduce correct environment for it" );
}
} );

QUnit.test( "jQuery.easing._default (gh-2218)", function( assert ) {
assert.expect( 2 );

@@ -2183,17 +2183,6 @@ testIframeWithCallback(
}
);

testIframeWithCallback(
"domManip executes scripts in iframes in the iframes' context",
"manipulation/scripts-context.html",
function( frameWindow, bodyElement, html, assert ) {
assert.expect( 2 );
jQuery( bodyElement ).append( html );
assert.ok( !window.scriptTest, "script executed in iframe context" );
assert.ok( frameWindow.scriptTest, "script executed in iframe context" );
}
);

QUnit.test( "jQuery.clone - no exceptions for object elements #9587", function( assert ) {

assert.expect( 1 );
@@ -2297,45 +2286,28 @@ QUnit.test( "Ensure oldIE creates a new set on appendTo (#8894)", function( asse
assert.strictEqual( jQuery( "<p/>" ).appendTo( "<div/>" ).end().length, jQuery( "<p>test</p>" ).appendTo( "<div/>" ).end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" );
} );

QUnit.asyncTest( "html() - script exceptions bubble (#11743)", 2, function( assert ) {
QUnit.test( "html() - script exceptions bubble (#11743)", function( assert ) {
assert.expect( 3 );

// Support: Android 2.3 only
// Android 2.3 doesn't fire the window.onerror handler, just accept the reality there.
if ( /android 2\.3/i.test( navigator.userAgent ) ) {
assert.ok( true, "Test skipped, Android 2.3 doesn't fire window.onerror for " +
"errors in dynamically included scripts" );
assert.ok( true, "Test skipped, Android 2.3 doesn't fire window.onerror for " +
"errors in dynamically included scripts" );
QUnit.start();
return;
}
assert.throws(function() {
jQuery("#qunit-fixture").html("<script>undefined(); ok( false, 'Exception not thrown' );</script>");
assert.ok( false, "Exception ignored" );
}, "Exception bubbled from inline script" );

var onerror = window.onerror;
if ( jQuery.ajax ) {
var onerror = window.onerror;
window.onerror = function() {
assert.ok( true, "Exception thrown in remote script" );
};

setTimeout( function() {
jQuery("#qunit-fixture").html("<script src='data/badcall.js'></script>");
assert.ok( true, "Exception ignored" );
window.onerror = onerror;

QUnit.start();
}, 1000 );

window.onerror = function() {
assert.ok( true, "Exception thrown" );

if ( jQuery.ajax ) {
window.onerror = function() {
assert.ok( true, "Exception thrown in remote script" );
};

jQuery( "#qunit-fixture" ).html( "<script src='data/badcall.js'></script>" );
assert.ok( true, "Exception ignored" );
} else {
assert.ok( true, "No jQuery.ajax" );
assert.ok( true, "No jQuery.ajax" );
}
};

jQuery( "#qunit-fixture" ).html( "<script>undefined();</script>" );
} );
} else {
assert.ok( true, "No jQuery.ajax" );
assert.ok( true, "No jQuery.ajax" );
}
});

QUnit.test( "checked state is cloned with clone()", function( assert ) {