Navigation re-factor update
This week, we’re continuing our work on the Ajax navigation re-write. There are a number of dimensions involved in this re-write including:
- More flexible URL handling:
- in-progress, test written, code changes should land soon by Kin
- outline of changes are documented on the wiki
- Extensibility hooks for dynamic page creation
- Steven Black will start a wiki page with suggesitons
- Caching: add a simple “don’t cache” flag per page
- A new data-cache attribute on the page div to tell framework to re-load it if shown again, default is “true” (re-use the page) but you can set data-cache=”false” to tell the framework to re-load ever time it’s viewed
- Issue created in the tracker
- Memory management: how to keep the DOM from getting too big?
- Add a new global configuration option to set the max number of pages to keep in the DOM at once. Once that max is hit, we run a a document-wide $(“selector”).remove() at the appropriate juncture in every changePage invocation (post Ajax success) that finds all pages that are data-cache=”false” or oldest in the stack and delete them. We’ll need to check for alreadyLocalPage = (“[data-url='...']:not([data-cache='false']“)
- Default to a sensible number like 15-20 pages but this can be overridden to any number more than 2 (to allow for transitions) or turned off completely
- Issue created in the tracker:
- Focus: can we handle this better?
- we need to have focus brought to the top of the current page on transition for accessibility and keyboard/focus-based navigation
- Scott Jehl will create a wiki page with suggestions
- Transitions: how to smooth out, eliminate blinking
- Kin will tackle this after URLs
View source bookmarklet
Doug Neiner, a jQuery core team member and all-around design genius just created a cool view source bookmarklet that makes is super easy to view the source of any jQuery Mobile page. Since we use Ajax-based navigation that uses the hash to track page state, it requires a bit of hacking to the URL to get the source of the page but this bookmarklet makes it a breeze. We’ll look into adding this to our demo pages so everyone can enjoy the convenience. Thanks Doug!
Notable changes this week
Updated jQuery Mobile to run of jQuery core 1.6 Until this week, we were running on the 1.6 RC but we’ve moved over to the final version of 1.6 and things seem to be working great.
Radiobuttons can’t be selected once they are selected, then de-selected. Fixed by using jQuery attr accessor instead of expando to guarantee consistent values. (issue 1532)
Multiple calendars generated inadvertently in multi-page docs. The each callback in the pagecreate method was creating multiple calendars when used with a multi-page html file. Fixed by scoping to the current page instead of the entire document. Thanks edelabar!
Regex breaking Firefox >3.6 Fixed by Remove greedy matches from start and end of regex – there’s no need for them, and they cause immense slowdown (on the order of 3-4 seconds on medium-size pages loaded via ajax). Thanks Paul Nicholls! (issue 1514)
Fixed base tag support. This change sets the base tag properly on page load and page changes, corresponding with the recent change to absolute path hash urls. Images and other assets will direct relative to the document in which they reside. This may not cover new path situations we’ve documented recently (changes underway), but it does fix the regression so things work as they did before the change. Tested in non-base supporting browsers to verify it works there too. (issue 1508)
Can’t load file:// pages. Fixed a regression that caused the base tag to be reset to file:// (literally with no path). All that was missing was a small tweak to base.reset() to use the new initialPath variable instead of docBase. (issue 1578)
Get the latest builds on the jQuery CDN
To take advantage of the daily improvements happening in jQuery Mobile, be sure to check out out the new daily and latest builds that are now available on the jQuery CDN for hotlinking. This allows you to upgrade to the latest code without waiting for the next official release.