You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Robert Hoffmann <ho...@cbio.mskcc.org> on 2012/04/22 19:00:50 UTC
Bug in cordova.js boot mechanism
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
Re: Bug in cordova.js boot mechanism
Posted by Filip Maj <fi...@adobe.com>.
Issue 499 (https://issues.apache.org/jira/browse/CB-499) described this
exact problem.
It has been fixed a few days ago
(http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commit
;h=2a8cdb98b764fcdd513d049ea5a35d95c3a119e2)
If you pull the latest cordova-js master, rebuild the JS and swap that in,
it should fix your issue.
On 4/22/12 10:00 AM, "Robert Hoffmann" <ho...@cbio.mskcc.org> wrote:
>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