scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 124  →  ?path2? @ 125
/bower_components/jquery/src/core/ready.js
@@ -1,32 +1,20 @@
define( [
define([
"../core",
"../var/document",
"../core/readyException",
"../core/init",
"../deferred"
], function( jQuery, document ) {
], function( jQuery ) {
 
"use strict";
 
// The deferred used on DOM ready
var readyList = jQuery.Deferred();
var readyList;
 
jQuery.fn.ready = function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
 
readyList
.then( fn )
 
// Wrap jQuery.readyException in a function so that the lookup
// happens at the time of error handling instead of callback
// registration.
.catch( function( error ) {
jQuery.readyException( error );
} );
 
return this;
};
 
jQuery.extend( {
 
jQuery.extend({
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
 
@@ -61,35 +49,49 @@
 
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
 
// Trigger any bound ready events
if ( jQuery.fn.triggerHandler ) {
jQuery( document ).triggerHandler( "ready" );
jQuery( document ).off( "ready" );
}
}
} );
});
 
jQuery.ready.then = readyList.then;
 
// The ready event handler and self cleanup method
/**
* The ready event handler and self cleanup method
*/
function completed() {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
jQuery.ready();
}
 
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 10 only
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
 
// Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready );
readyList = jQuery.Deferred();
 
} else {
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// We once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
 
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed );
} else {
 
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
}
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
 
} );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
}
}
return readyList.promise( obj );
};
 
// Kick off the DOM ready check even if the user does not
jQuery.ready.promise();
 
});