New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigating back is broken with autoInitializePage = false (Cannot call method 'trigger' of undefined) #5284

Closed
rbu opened this Issue Nov 14, 2012 · 7 comments

Comments

Projects
None yet
5 participants
@rbu

rbu commented Nov 14, 2012

When navigating away from a jQueryMobile application and then back creates an exception when that application has set $.mobile.autoInitializePage = false and calls $.mobile.initializePage() by itself.

Steps to reproduce:

  1. Open http://jsbin.com/ukewu3/279
  2. Click any link inside the page (e.g. jsFiddle)
  3. Use browser's back button
  4. Open JS console

Expected result:
See meaningless debug output

Actual result:
Uncaught TypeError: Cannot call method 'trigger' of undefined

This stems from the fact that $.mobile.pageContainer is undefined before initializePage

@rbu

This comment has been minimized.

Show comment
Hide comment
@rbu

rbu Nov 14, 2012

We're currently using the following monkey-patch for this:

// Monkey patch for jQM bug
// https://github.com/jquery/jquery-mobile/issues/5284
$.mobile._handleHashChange = (function(old) {
    return function() {
        if (undefined === $.mobile.pageContainer) {
            return;
        }
        return old.apply(this, arguments);
    };
}($.mobile._handleHashChange));

rbu commented Nov 14, 2012

We're currently using the following monkey-patch for this:

// Monkey patch for jQM bug
// https://github.com/jquery/jquery-mobile/issues/5284
$.mobile._handleHashChange = (function(old) {
    return function() {
        if (undefined === $.mobile.pageContainer) {
            return;
        }
        return old.apply(this, arguments);
    };
}($.mobile._handleHashChange));
@iMoses

This comment has been minimized.

Show comment
Hide comment
@iMoses

iMoses Mar 5, 2013

I've been experiencing the exact same problem

iMoses commented Mar 5, 2013

I've been experiencing the exact same problem

@hgross

This comment has been minimized.

Show comment
Hide comment
@hgross

hgross Mar 20, 2013

+1 - Any news on this?

hgross commented Mar 20, 2013

+1 - Any news on this?

@ghost ghost assigned johnbender Apr 4, 2013

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Apr 4, 2013

Contributor

Switching to the unminified latest I see an issue with the loader widget not with trigger. Still it's clearly not working.

I'll take a look today and hopefully we can work out something sane and quick for the first patch release.

Contributor

johnbender commented Apr 4, 2013

Switching to the unminified latest I see an issue with the loader widget not with trigger. Still it's clearly not working.

I'll take a look today and hopefully we can work out something sane and quick for the first patch release.

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Apr 4, 2013

Contributor

The broader issue is that the popstate binding is firing "too early" when returning to the page. I'm going to have to work on this one for a bit.

@rbu

That fits with your hack since you're just killing the navigation when the pageContainer hasn't been created.

Contributor

johnbender commented Apr 4, 2013

The broader issue is that the popstate binding is firing "too early" when returning to the page. I'm going to have to work on this one for a bit.

@rbu

That fits with your hack since you're just killing the navigation when the pageContainer hasn't been created.

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Apr 4, 2013

Contributor

@rbu @hgross @uGoMobi

There's a fundamental issue with delaying the page initialization and supporting popstate. The popstate that's fired when returning from an external URL contains information about how the page should be initialized, so delaying the initialization means we need to store that info until it happens.

More soon.

Contributor

johnbender commented Apr 4, 2013

@rbu @hgross @uGoMobi

There's a fundamental issue with delaying the page initialization and supporting popstate. The popstate that's fired when returning from an external URL contains information about how the page should be initialized, so delaying the initialization means we need to store that info until it happens.

More soon.

@imran1231

This comment has been minimized.

Show comment
Hide comment
@imran1231

imran1231 Mar 2, 2014

Getting same issue on JQUERY Mobile 1.4.0

imran1231 commented Mar 2, 2014

Getting same issue on JQUERY Mobile 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment