azicchetti/jquerymobile-router

pagebeforechange doesn't work with JQM 1.1.1

Opened this issue · 5 comments

That is, the router doesn't work with the new version of the jQuery Mobile.
Could u please have a look on this issue?
Thanks

Hi,
I've not yet tested it extensively (I'm quite busy atm), but it seems to work as expected, at least for the most basic test cases under the examples/ directory (jquery mobile 1.1.1, jquery 1.7.1).

Please provide some code if you find that something is off.
Thank you!

For example, u can test the /test-bC.html. If u are on #localpage4 page and reload it, the index appears.

Uh, the pagebeforechange event...

For that specific test-case, it seems a jquery mobile bug to me but I've not yet debugged anything.

However, I wouldn't recommend using that event from the router because it breaks other useful routes and somehow conflicts with the router itself.

If you need to inject pages into the dom by hand, switch to a "fake" ajax approach, disable pushState and use the pagebeforeload event.

In case this approach is not of your liking, I suggest you attach a pagebeforechange handler before the router javascript file is loaded and take things over from that point.

I see what u mean, but for example if I do your last point, which seems quite ok, I might not need the plugin, don't u think?
Anyway, and as u commeneted , after doing some more tests with the pagebeforechange event, it might be a jquery mobile problem!

Il 13/07/2012 16:23, joanscript ha scritto:

I see what u mean, but for example if I do your last point, which seems quite ok, I might not need the plugin, don't u think?

Yeah, it would probably be less useful but still usable for certain
events (pagebeforeshow, pagehide, etc).

I usually use the first approach for complex applications, it also keeps
the dom small due to the automatic page removal mechanism of jquery mobile.
It can be mixed with a certain number of local "hash pages" that should
be kept in the dom right from the beginning.