remove jQuery.quickReady, save bytes, style nits in tests

This commit is contained in:
Mike Sherov
2012-05-04 09:57:32 -04:00
parent bab6f5355c
commit f925c7a1c9
6 changed files with 50 additions and 100 deletions

View File

@@ -1,32 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test case for jQuery ticket #10067</title>
<script type="text/javascript">
// ready should fire callback after the iframe fires the callback
setTimeout(function () {
el = document.createElement('script');
el.type = 'text/javascript';
el.onload = function () {
jQuery.quickReady = false;
jQuery(document).ready(function () {
// unfortunately, Opera 11.6 and lower has a bug where
// document.readyState is "complete" before all subresources
// are loaded, so we need this check here for tests to pass
if ( document.readyState !== "complete" ) {
window.parent.iframeCallback(false);
}
});
}
document.getElementsByTagName('head')[0].appendChild(el);
el.src = "../include_js.php";
}, 1000);
</script>
</head>
<body>
<!-- long loading iframe -->
<iframe src="longLoad.php?sleep=3&return=true" style="width: 1px; height: 1px"></iframe>
</body>
</html>

View File

@@ -1,30 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test case for jQuery ticket #10067</title>
<script type="text/javascript">
// browsers that implement the non-standard event API will load the iframe
// before loading up jQuery, so quickReady has no effect here
if( document.attachEvent ){
window.parent.iframeCallback(true);
} else {
setTimeout(function () {
el = document.createElement('script');
el.type = 'text/javascript';
el.onload = function () {
jQuery(document).ready(function () {
window.parent.iframeCallback(true);
});
}
document.getElementsByTagName('head')[0].appendChild(el);
el.src = "../include_js.php";
}, 1000);
}
</script>
</head>
<body>
<!-- long loading iframe -->
<iframe src="longLoad.php?sleep=30&return=false" style="width: 1px; height: 1px"></iframe>
</body>
</html>

View File

@@ -0,0 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test case for jQuery ticket #10067</title>
<script type="text/javascript">
if ( document.attachEvent ) {
// browsers that use the non-standard event API will load the iframe
// before jQuery, so there's no way to fire ready before the iframe loads
window.parent.iframeCallback( true );
} else {
setTimeout(function() {
el = document.createElement("script");
el.type = "text/javascript";
el.onload = function() {
jQuery( document ).ready(function() {
window.parent.iframeCallback( true );
});
}
document.getElementsByTagName("head")[ 0 ].appendChild( el );
el.src = "../include_js.php";
}, 1000 );
}
</script>
</head>
<body>
<!-- long loading iframe -->
<iframe src="longLoad.php?sleep=15&return=false" style="width: 1px; height: 1px"></iframe>
</body>
</html>

View File

@@ -7,8 +7,8 @@
</head>
<body>
<script type="text/javascript">
jQuery(document).ready(function () {
window.parent.iframeCallback(true);
jQuery( document ).ready(function () {
window.parent.iframeCallback( true );
});
</script>
<!-- long loading iframe -->

View File

@@ -2794,23 +2794,20 @@ test("fixHooks extensions", function() {
jQuery.event.fixHooks.click = saved;
});
testIframeWithCallback( "jQuery.ready sync load", "event/syncReady", function( isOk ) {
expect(1);
ok( isOk, "jQuery loaded synchronously fires ready before all sub-resources are loaded" );
});
// async loaded tests expect jQuery to be loaded as a single file
// if we're not doing PHP concat, then we fall back to document.write
// which breaks order of execution on async loaded files
// also need PHP to make the incepted IFRAME hang
if ( hasPHP ) {
testIframeWithCallback( "jQuery.ready async load with quickReady true", "event/asyncQuickReadyTrue", function( isOk ) {
testIframeWithCallback( "jQuery.ready synchronous load with long loading iframe", "event/syncReady", function( isOk ) {
expect(1);
ok( isOk, "jQuery loaded asynchronously with quickReady true fires ready before all sub-resources are loaded" );
ok( isOk, "jQuery loaded synchronously fires ready before all sub-resources are loaded" );
});
testIframeWithCallback( "jQuery.ready async load with quickReady false", "event/asyncQuickReadyFalse", function( isOk ) {
testIframeWithCallback( "jQuery.ready asynchronous load with long loading iframe", "event/asyncReady", function( isOk ) {
expect(1);
ok( isOk, "jQuery loaded asynchronously with quickReady false fires ready after all sub-resources are loaded" );
ok( isOk, "jQuery loaded asynchronously fires ready before all sub-resources are loaded" );
});
}