corrade-nucleus-nucleons – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | define( [ |
2 | "../core", |
||
3 | "../var/document", |
||
4 | "../core/readyException", |
||
5 | "../deferred" |
||
6 | ], function( jQuery, document ) { |
||
7 | |||
8 | "use strict"; |
||
9 | |||
10 | // The deferred used on DOM ready |
||
11 | var readyList = jQuery.Deferred(); |
||
12 | |||
13 | jQuery.fn.ready = function( fn ) { |
||
14 | |||
15 | readyList |
||
16 | .then( fn ) |
||
17 | |||
18 | // Wrap jQuery.readyException in a function so that the lookup |
||
19 | // happens at the time of error handling instead of callback |
||
20 | // registration. |
||
21 | .catch( function( error ) { |
||
22 | jQuery.readyException( error ); |
||
23 | } ); |
||
24 | |||
25 | return this; |
||
26 | }; |
||
27 | |||
28 | jQuery.extend( { |
||
29 | |||
30 | // Is the DOM ready to be used? Set to true once it occurs. |
||
31 | isReady: false, |
||
32 | |||
33 | // A counter to track how many items to wait for before |
||
34 | // the ready event fires. See #6781 |
||
35 | readyWait: 1, |
||
36 | |||
37 | // Handle when the DOM is ready |
||
38 | ready: function( wait ) { |
||
39 | |||
40 | // Abort if there are pending holds or we're already ready |
||
41 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
||
42 | return; |
||
43 | } |
||
44 | |||
45 | // Remember that the DOM is ready |
||
46 | jQuery.isReady = true; |
||
47 | |||
48 | // If a normal DOM Ready event fired, decrement, and wait if need be |
||
49 | if ( wait !== true && --jQuery.readyWait > 0 ) { |
||
50 | return; |
||
51 | } |
||
52 | |||
53 | // If there are functions bound, to execute |
||
54 | readyList.resolveWith( document, [ jQuery ] ); |
||
55 | } |
||
56 | } ); |
||
57 | |||
58 | jQuery.ready.then = readyList.then; |
||
59 | |||
60 | // The ready event handler and self cleanup method |
||
61 | function completed() { |
||
62 | document.removeEventListener( "DOMContentLoaded", completed ); |
||
63 | window.removeEventListener( "load", completed ); |
||
64 | jQuery.ready(); |
||
65 | } |
||
66 | |||
67 | // Catch cases where $(document).ready() is called |
||
68 | // after the browser event has already occurred. |
||
69 | // Support: IE <=9 - 10 only |
||
70 | // Older IE sometimes signals "interactive" too soon |
||
71 | if ( document.readyState === "complete" || |
||
72 | ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { |
||
73 | |||
74 | // Handle it asynchronously to allow scripts the opportunity to delay ready |
||
75 | window.setTimeout( jQuery.ready ); |
||
76 | |||
77 | } else { |
||
78 | |||
79 | // Use the handy event callback |
||
80 | document.addEventListener( "DOMContentLoaded", completed ); |
||
81 | |||
82 | // A fallback to window.onload, that will always work |
||
83 | window.addEventListener( "load", completed ); |
||
84 | } |
||
85 | |||
86 | } ); |