incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Hoffmann" <hoffm...@cbio.mskcc.org>
Subject Bug in cordova.js boot mechanism
Date Sun, 22 Apr 2012 17:00:50 GMT
Hi,

We use cordova with GWT (on iOS) and we ran into a situation where the 
1) "document.addEventListener('DOMContentLoaded', function()..." in the boot sequence is called
after the event has already fired
2) BUT the document.readyState is NOT YET 'complete' but 'loaded' 

CURRENT code in cordova.js
>>
            boot: function () {
                //---------------
                // Event handling
                //---------------

                /**
                 * Listen for DOMContentLoaded and notify our channel subscribers.
                 */
                document.addEventListener('DOMContentLoaded', function() {
                    alert("loaded");
                    channel.onDOMContentLoaded.fire();
                }, false);
                if (document.readyState == 'complete') {
                    //alert("ready");
                  channel.onDOMContentLoaded.fire();
                }
<<

thus I suggest to change it too 

>>
            boot: function () {
                //---------------
                // Event handling
                //---------------

                /**
                 * Listen for DOMContentLoaded and notify our channel subscribers.
                 */
                document.addEventListener('DOMContentLoaded', function() {
                    alert("loaded");
                    channel.onDOMContentLoaded.fire();
                }, false);
                if (document.readyState == 'complete' || document.readyState == 'loaded')
{
                    //alert("ready");
                  channel.onDOMContentLoaded.fire();
                }
<<


This seems to affect different target platforms, at least iOS and android.

Best wishes,

Robert

Mime
View raw message