mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 17:14:58 -05:00
Core: Add test for jQuery.ready.promise fallback load
Fix #13655
Close gh-1209
Ref 32b066d380
This commit is contained in:
3
test/data/core/dont_return.php
Normal file
3
test/data/core/dont_return.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
sleep(10000);
|
||||
?>
|
||||
35
test/data/core/dynamic_ready.html
Normal file
35
test/data/core/dynamic_ready.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script src="../../jquery.js"></script>
|
||||
<script>var $j = jQuery.noConflict();</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="dont_return" src="dont_return.php"></iframe>
|
||||
<script>
|
||||
var timeoutId, $,
|
||||
timeoutFired = false;
|
||||
|
||||
setTimeout(function () {
|
||||
// Load another jQuery copy using the first one.
|
||||
$j.getScript( "../../../dist/jquery.js", function () {
|
||||
$j( "#dont_return" ).attr( "src", "about:blank" );
|
||||
|
||||
// document ready handled by the just-loaded jQuery copy.
|
||||
$(function () {
|
||||
clearTimeout( timeoutId );
|
||||
if ( !timeoutFired ) {
|
||||
window.parent.iframeCallback( true );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
timeoutId = setTimeout(function () {
|
||||
timeoutFired = true;
|
||||
window.parent.iframeCallback( false );
|
||||
}, 3000);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user