{"issue":{"milestone":{"open_issues":17,"created_at":"2011-11-17T17:20:16Z","creator":{"id":359929,"login":"toddparker","url":"https://api.github.com/users/toddparker","avatar_url":"https://secure.gravatar.com/avatar/4ec3e17536d217f2367be3aebb72a72b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"4ec3e17536d217f2367be3aebb72a72b"},"title":"1.0.1","state":"open","due_on":null,"closed_issues":7,"number":12,"description":"","url":"https://api.github.com/repos/jquery/jquery-mobile/milestones/12"},"user":{"id":1214352,"login":"daniel-chambers","url":"https://api.github.com/users/daniel-chambers","avatar_url":"https://secure.gravatar.com/avatar/2f64d9c4e3a6c51170fac46f54093953?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"2f64d9c4e3a6c51170fac46f54093953"},"created_at":"2011-11-23T00:24:34Z","title":"Loading message is not hidden after using preventDefault in pageloadfailed event","updated_at":"2011-12-19T23:48:06Z","labels":[{"name":"3 - Medium","url":"https://api.github.com/repos/jquery/jquery-mobile/labels/3+-+Medium","color":"f5b800"}],"state":"open","id":2325025,"html_url":"https://github.com/jquery/jquery-mobile/issues/3143","closed_at":null,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"If you listen to the pageloadfailed event and call event.preventDefault() (and later either data.deferred.success or .reject), the loading message is not hidden and stays on the page.\r\n\r\nI have created a reproduction on jsfiddle here: http://jsfiddle.net/3PVpj/2/\r\n\r\nWhen you click \"Go to next page\", jQuery will try to load a page that does not exist and fire the pageloadfailed event. I handle that event and call preventDefault and then call reject. You can see in the preview pane that the loading message sticks on the page and does not close.\r\n\r\nI have reproduced this on jQuery Mobile 1.0 Final.\r\n\r\nLooking at the jQuery Mobile code, it seems that the $.mobile.loadPage's ajax error function deliberately skips the hiding of the loading message when preventDefault is called. Unfortunately, there doesn't seem to be a way to force close the loading message myself cleanly, because it is shown using a timer and the timer's handle is private to the loadPage function. The loadPage function uses a private function hideMsg to close the loading message, but it doesn't make that available for use by the handler of pageloadfailed. $.mobile.hidePageLoadingMsg can't be called directly as a workaround because it's possible it'll be called before the timer has actually displayed the message.","number":3143,"url":"https://api.github.com/repos/jquery/jquery-mobile/issues/3143","comments":3,"assignee":{"id":394996,"login":"jblas","url":"https://api.github.com/users/jblas","avatar_url":"https://secure.gravatar.com/avatar/fa72320f7fd01aa7d743768f85ccf9ea?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"fa72320f7fd01aa7d743768f85ccf9ea"}},"comment":{"user":{"id":716323,"login":"redaemn","url":"https://api.github.com/users/redaemn","avatar_url":"https://secure.gravatar.com/avatar/c9f630c12def97f1c1f896cbb2834b30?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c9f630c12def97f1c1f896cbb2834b30"},"created_at":"2011-12-19T23:48:05Z","updated_at":"2011-12-19T23:48:05Z","id":3211793,"body":"I was looking at the code: maybe the function to hide the loading message could be attached to the `deferred` object returned by `loadPage()` (using `deferred.then()` or something like that); in this way it will be executed when the deferred will be *resolved* or *rejected*","url":"https://api.github.com/repos/jquery/jquery-mobile/issues/comments/3211793"},"action":"created"}