| 3470 | } |
| 3471 | |
| 3472 | function jqLiteReady(fn) { |
| 3473 | function trigger() { |
| 3474 | window.document.removeEventListener('DOMContentLoaded', trigger); |
| 3475 | window.removeEventListener('load', trigger); |
| 3476 | fn(); |
| 3477 | } |
| 3478 | |
| 3479 | // check if document is already loaded |
| 3480 | if (window.document.readyState === 'complete') { |
| 3481 | window.setTimeout(fn); |
| 3482 | } else { |
| 3483 | // We can not use jqLite since we are not done loading and jQuery could be loaded later. |
| 3484 | |
| 3485 | // Works for modern browsers and IE9 |
| 3486 | window.document.addEventListener('DOMContentLoaded', trigger); |
| 3487 | |
| 3488 | // Fallback to window.onload for others |
| 3489 | window.addEventListener('load', trigger); |
| 3490 | } |
| 3491 | } |
| 3492 | |
| 3493 | ////////////////////////////////////////// |
| 3494 | // Functions which are declared directly. |