Exception in $.mobile.focusPage function with native iPhone #5029

Closed
quanta42 opened this Issue Sep 18, 2012 · 6 comments

Comments

Projects
None yet
5 participants
@quanta42

Hi,

when I load my app with Cordova 1.7.0 with jqm 1.2.0-rc1 and jq 1.8.1, I have an issue during the initialization and each time I use $.mobile.changePage("#name_of_the_hash").
Here is the jsbin link to a simple test page: http://jsbin.com/uwaxaj/13/edit

I just copied/paste that in an html file, added cordova.js and run this example through iphone simulator 5 and 6 and I got Error: SYNTAX_ERR: DOM Exception 12.

Luckily for you, I was able to see what line cause the problem: line 3245 (jqm 1.2.0-rc1).
More precisely, the exception happens when this line is executed: pageTitle = page.find( ".ui-title:eq(0)" );

If I do a page.find(".ui-title"), it returns an empty array.

Thanks,

@oiva

This comment has been minimized.

Show comment
Hide comment
@oiva

oiva May 17, 2013

Contributor

I'm seeing this with jqm 1.3.1 and jQuery 1.9.1, running in iPhone simulator. Both titles seem to exist.

I found out that you can get rid of the error by changing from

$.mobile.focusPage = function ( page ) {
        var autofocus = page.find( "[autofocus]" ),
            pageTitle = page.find( ".ui-title:eq(0)" );

...to this

$.mobile.focusPage = function ( page ) {
    var autofocus = page.find( "[autofocus]" ),
        pageTitle = page.find( ".ui-title" ).first();
Contributor

oiva commented May 17, 2013

I'm seeing this with jqm 1.3.1 and jQuery 1.9.1, running in iPhone simulator. Both titles seem to exist.

I found out that you can get rid of the error by changing from

$.mobile.focusPage = function ( page ) {
        var autofocus = page.find( "[autofocus]" ),
            pageTitle = page.find( ".ui-title:eq(0)" );

...to this

$.mobile.focusPage = function ( page ) {
    var autofocus = page.find( "[autofocus]" ),
        pageTitle = page.find( ".ui-title" ).first();
@mitchp

This comment has been minimized.

Show comment
Hide comment
@mitchp

mitchp Aug 2, 2013

oops... I commented the same thing on 6019... sorry... Good fix!

mitchp commented Aug 2, 2013

oops... I commented the same thing on 6019... sorry... Good fix!

@ldeluca

This comment has been minimized.

Show comment
Hide comment
@ldeluca

ldeluca Sep 30, 2014

Contributor

@quanta42 I can't tell based on these comments. Is this issue fixed?

Contributor

ldeluca commented Sep 30, 2014

@quanta42 I can't tell based on these comments. Is this issue fixed?

@quanta42

This comment has been minimized.

Show comment
Hide comment
@quanta42

quanta42 Oct 1, 2014

@ldeluca I cannot reproduce this issue using jqm 1.4.4 and jq 2.1.1

quanta42 commented Oct 1, 2014

@ldeluca I cannot reproduce this issue using jqm 1.4.4 and jq 2.1.1

@ldeluca

This comment has been minimized.

Show comment
Hide comment
@ldeluca

ldeluca Oct 1, 2014

Contributor

Mind closing it out if you think it is fixed @quanta42?

Contributor

ldeluca commented Oct 1, 2014

Mind closing it out if you think it is fixed @quanta42?

@arschmitz

This comment has been minimized.

Show comment
Hide comment
@arschmitz

arschmitz Oct 1, 2014

Member

Im going to close this as fixed.

Member

arschmitz commented Oct 1, 2014

Im going to close this as fixed.

@arschmitz arschmitz closed this Oct 1, 2014

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