Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

pagechangefailed not triggered when changing to non-existent internal page #2835

Closed
offsky opened this issue Oct 25, 2011 · 5 comments
Closed
Assignees
Milestone

Comments

@offsky
Copy link

offsky commented Oct 25, 2011

When a link contains a hashtag (hfref="#foo"), clicking on it should load the page div in the DOM with that id. If a page with that id does not exist, it should trigger an error and not transition. What happens instead is that a duplicate page is created for the root URL and inserted into the DOM and an incorrect transition is made.

<body> 
<div data-role="page" id="home">
    <div data-role="content">   
        <ul data-role="listview"> 
            <li><a href="#foo">This doesn't exist but no error is given</a></li>
            <li><a href="/bar.html">This doesn't exist and an error is given</a></li>
        </ul>
    </div>
</div>
</body>

Clicking on the "#foo" link: The DOM now has two pages with the same id "home", and no pagechangefailed event was triggered.

What I would like to happen is that the pagechangefailed error is triggered, and no transition happens and nothing is inserted into the DOM. This will give me the opportunity to create the missing page.

@jblas
Copy link
Contributor

jblas commented Oct 25, 2011

@offsky what version of the framwork are you using?

@offsky
Copy link
Author

offsky commented Oct 25, 2011

@offsky
Copy link
Author

offsky commented Oct 25, 2011

Here is jsfiddler that demonstrates: http://jsfiddle.net/5tmFU/show/

@ghost ghost assigned jblas Oct 25, 2011
@jblas
Copy link
Contributor

jblas commented Oct 25, 2011

I have a fix for this, I'm just working on the unit test.

jblas added a commit that referenced this issue Oct 26, 2011
… non-existent internal page

- Modified loadPage() so that it bails if an embedded page is not found within the DOM.
jblas added a commit that referenced this issue Oct 26, 2011
…n changing to non-existent internal page.
@jblas
Copy link
Contributor

jblas commented Oct 26, 2011

I landed the fix for this on the HEAD. Should appear in 1.0 final.

@jblas jblas closed this as completed Oct 26, 2011
timmywil pushed a commit to timmywil/jquery-mobile that referenced this issue Nov 5, 2011
…en changing to non-existent internal page

- Modified loadPage() so that it bails if an embedded page is not found within the DOM.
timmywil pushed a commit to timmywil/jquery-mobile that referenced this issue Nov 5, 2011
… triggered when changing to non-existent internal page.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants