Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I used it with PhoneGap. I had no issues with PhoneGap, and unlimited issues with jQuery Mobile.

Basically, jQuery Mobile wants your whole app to be on one page. You can either have one giant HTML file that has a bunch of divs representing multiple pages, or you can have several different HTML files and link them as normal. Then jQuery Mobile will take all of your anchor links and turn them into something that fetches that page's contents and inserts it into the DOM of the current page, instead of loading a new page. Then their "page transitions" are triggering hide and show actions on the various pages in the DOM.

This also makes registering event handlers awful. First, all of your javascript has to be in one file and it has to be included in every page that a user could possibly navigate to. This means that you can't just bind on document.ready like normal, because some of the elements you're binding to don't actually exist on the page until you try and navigate to the page.

Then, jQuery Mobile uses custom events to tell you when there's been a page transition. However, you can't put your event bindings in there, either, because then your event bindings will be reapplied every time the user navigates away from and back to that page - basically, every action will be applied multiple times. Terrible.

So this means that all of your bindings have to be live bindings. Oh, also, you need to make sure none of your elements on different pages have the same id since, in the long run, jQuery Mobile mashes them all onto one page.

Yeah, I may be a bit bitter.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: