diff options
Diffstat (limited to 'src/jqLite.js')
| -rw-r--r-- | src/jqLite.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jqLite.js b/src/jqLite.js index 1d92f2ab..2c209ecd 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -327,9 +327,14 @@ var JQLitePrototype = JQLite.prototype = { fn(); } - this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9 - // we can not use jqLite since we are not done loading and jQuery could be loaded later. - JQLite(window).bind('load', trigger); // fallback to window.onload for others + // check if document already is loaded + if (document.readyState === 'complete'){ + setTimeout(trigger); + } else { + this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9 + // we can not use jqLite since we are not done loading and jQuery could be loaded later. + JQLite(window).bind('load', trigger); // fallback to window.onload for others + } }, toString: function() { var value = []; |
