| 3581 | } |
| 3582 | |
| 3583 | function jqLiteReady(fn) { |
| 3584 | function trigger() { |
| 3585 | window.document.removeEventListener('DOMContentLoaded', trigger); |
| 3586 | window.removeEventListener('load', trigger); |
| 3587 | fn(); |
| 3588 | } |
| 3589 | |
| 3590 | // check if document is already loaded |
| 3591 | if (window.document.readyState === 'complete') { |
| 3592 | window.setTimeout(fn); |
| 3593 | } else { |
| 3594 | // We can not use jqLite since we are not done loading and jQuery could be loaded later. |
| 3595 | |
| 3596 | // Works for modern browsers and IE9 |
| 3597 | window.document.addEventListener('DOMContentLoaded', trigger); |
| 3598 | |
| 3599 | // Fallback to window.onload for others |
| 3600 | window.addEventListener('load', trigger); |
| 3601 | } |
| 3602 | } |
| 3603 | |
| 3604 | ////////////////////////////////////////// |
| 3605 | // Functions which are declared directly. |