diff options
| author | Jørgen Borgesen | 2013-02-06 12:15:18 +0100 |
|---|---|---|
| committer | Igor Minar | 2013-02-25 15:32:14 -0800 |
| commit | 753fc9e58d5e554d4930548558efecc283557eeb (patch) | |
| tree | 8a809d0388e597b49ece1f964ea22d951414ac1d /src/jqLite.js | |
| parent | 6a612df7de0162449d937d40b20b34a306ec9a75 (diff) | |
| download | angular.js-753fc9e58d5e554d4930548558efecc283557eeb.tar.bz2 | |
feat(JQLite): ready() now supports document.readyState=='complete'
JQLite.ready() used for automatic bootstrapping (when jQuery is not present)
now checks if document already is ready when first called. This simplifies
bootstrapping when the angular script is loaded asynchronously.
However if other scripts with angular app code are being loaded as well
it is developers responsibility to ensure that these scripts are loaded
after angular-loader.js is evaluated and before angular.js script is
evaluated.
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 = []; |
