azicchetti / jquerymobile-router

A router/controller for jquery mobile. Also adds support for client-side parameters in the hash part of the url. The routes handles regexp based routes. This plugin can be used alone or (better) with Backbone.js or Spine.js, because it's originally meant to replace their router with something integrated with jQM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jqmrouter broken with jquery 1.7.2 -- jqm also broken..

chrisben opened this issue · comments

When I upgraded jquery from 1.7.1 to 1.7.2, I get a js error at line 55 of jquery.mobile.router.js when visiting the first page of my app. The error is on this conditional test:

if ( u.hash.indexOf("?") !== -1 ) {

Here u.hash is undefined, so it logs:

Uncaught TypeError: Cannot call method 'indexOf' of undefined

When using 1.7.1 u.hash is an empty string : "" , so the function call still works.

The problem could be fixed by adding this test :

if ( u.hash && u.hash.indexOf("?") !== -1 ) {

But there seems to be a deeper problem behind this change of behaviour.. Actually when I look at the 'u' object its content seems quite different.

I get it, I guess jquerymobile itself is not compatible with 1.7.2, that's why even after this jqmrouter problem gets fixed I get more errors down the line...

I suppose I can carry on logging this issue, at least if other people find the same problem they will understand why, and I imagine adding a simple check for u.hash won't harm jquerymobilerouter either.

From the jquery 1.7.2 release notes:

Note: If you’re using jQuery Mobile, please use jQuery 1.7.2 only with jQuery Mobile 1.1. For previous versions of jQuery Mobile, stay with jQuery core 1.7.1 or earlier.

Hi,
I think you've found the source of the issue, thanks.

Unfortunately, jquery mobile 1.1.0rc1 introduces a few changes that require a patched version of the router to avoid some handlers being triggered twice when the back button is clicked.

I'm waiting a more "stable" version of the 1.1 branch to push these fixes to the router, so if you need maximum stability, please stick to the official stable release of jquery mobile: 1.0.1

Hi,
I've pushed a fix to support jqm 1.1.0rc2. jQuery Mobile still requires jQuery <=1.7.1