jQuery Mobile 1.2 Beta Released

Posted on by

The jQuery Mobile team is excited to announce the beta release of 1.2.0. Since we released the alpha a few weeks ago, we’ve been listening to your feedback and fixing as many issues as possible. We unearthed a few Android and WP browser bugs int he new popup widget that proved to be pretty tricky to work through so we ended up doing a fair amount of re-factoring to the code to work around the bugs.

As we spent a few weeks grinding away at workarounds for these browser bugs, we also landed another 60 fixes, upgraded to the UI 1.9 widget factory, and added full support for jQuery core 1.8.0 and 1.8.1. The upside is that the new code is now leaner, faster and more compatible.

Since we’ve made a fair amount of changes since alpha, we’ve decided to release this beta to help the community give the code a full runthrough to see if we are indeed ready for final release. Please help us test and report issues so we can move forward quickly. Try it now!

There are a ton of great new features in 1.2 so if you haven’t read up, see the 1.2 alpha blog post for full details, we’re just going to cover what’s new here. We’d also like to thank all our contributors who have helped make jQuery Mobile better.

Demos & docs | Change log | Download & CDN

The bugs: Real baddies

There were a few browser bugs in Android and WP7 that were very challenging for the team to debug and create workarounds for after alpha. Here is a rundown of the key bugs we’ve been wrestling with:

    • Visual z-index issues in Android 4.0 default browser (#4816 and #4874) – When fixed toolbars were used on a page, the use of any position:fixed elements cause havoc with rendering of stacked elements in Android. In these situations, the popup would visually appear under the overlay but was still clickable so this was just an odd a display bug. This issue was addressed by adding conditional logic that will toggle the toolbars from position:fixed to position:absolute when the popup is opened and closed. The drawback to this fix is fixed toolbars appear to hide when a popup is open, so we applied this workaround to only apply to cases where there are fixed toolbars and popups with an overlay theme on Android 4.0.
    • Animating overlay opacity bug in Android 4.0 Chrome (#4915) – The CSS-based fade in/out transition on the themed overlay causes similar visual stacking bugs as fixed toolbars in Chrome. This was addressed by removing the fade behavior on the overlay. Testing revealed that not animating the opacity of the overlay made the popup also display significantly faster so this change is now applied across the board for all browsers. The overlay now pops into place without a transition and adding a transition isn’t offered as an option.
    • Wild scrolling in WP7.5 when closing a popup (#4784) – When closing a popup in WP7, the window would appear to scroll to random locations. Turns out this was due to a bug in WP7’s history management that would not correctly remember the scroll position when we used the history and hashchange to close the popup. After spending over a week looking at possible solutions, the team has determined that this can not be worked around. To address this bug, we have excluded just WP7 from back button support with popups so these must be closed by clicking outside the popup or using a developer-supplied close button. We also had to handle the close button behavior to work without hashchange to work with this situation. The option to track history has been exposed as the “history” option now in the popup API: http://jquerymobile.com/branches/popup-simple/docs/pages/popup/options.html
    • Multiple, sticky button focus states in WP7 –  As popups were opened and closed, the blue outline of the focus state class would remain on the buttons that launched the popups. As it turns out, this was purely a display bug in related to WP7’s buggy history implementation. This issues was also fixed by excluding WP7 from history support.

Also in 1.2 – Custom collapsible icons

We forgot to mention in the alpha post that we added the ability to configure the icons for the expanded and collapsed states of a collapsibles and collapsible sets. Collapsible headings’ default icons can be overridden by using the data-collapsed-icon and data-expanded-icon attributes and choosing any of the standard icons for each.

Popup history tracking: Now an option

We heard feedback at alpha that some developers didn’t want to track popups in the history stack. Using the browser Back button to dismiss popups and menus is an important UI convention on many mobile platforms but there may be use cases like an iOS app where this is less of a concern.

Since we had to exclude WP7 from the history support to workaround a bug anyway, we decided to surface this mechanism in the popup API as the history option, a boolean that defaults to true but can be set via the data-history="false" attribute or when calling popup:

$( ".selector" ).popup({ history: false });

Popups must live within the page wrapper (for now)

After alpha went out, we also heard pretty clear feedback that folks want to re-use popups across pages by placing them outside the page container. At the moment this won’t work because many widgets (listviews, toolbars) are built with the assumption that they live inside a page container for theme inheritance and enhancement to work. Until these widgets are re-factored to work outside of pages at a future release, popups should only be added within a page.

Change log (since 1.2 alpha)

Button

Override default margin if controlgroups or form elements have class ui-btn-left/right (Issue: #4713)

CSS

Remove a typo in jquery.mobile.theme CSS (Issue: #4910)
– Corrected a typo in button hover CSS. Mitch64!

Set webkit-text-size-adjust to 100% instead of “none” (Issue: #4218)
– Fixes a desktop webkit browser bug that prevents text zoom.

Collapsible

Add support for same expanded/collapsed non default icon (Issue: #4801)
– Collapsibles now can have the same non-default icon for collapsed/expanded state.

Controlgroup

Float none for select and checkboxradio ui-btn because their container div already has float left

Keep the possibility to center the controls with vertical-align property (Issue: #4765)

Make icon-only buttons default to mini in toolbars
– Toolbar buttons without text (data-iconpos="notext") now get the mini style by default.

Prevent small bottom margin that some browsers add because of display inline-block
– Horizontal controlgoups now getting centered vertical alignment to prevent a small margin, that some browsers add to buttons.

Prevent the controls inside controlgroups from being wrapped multiple times (Issue: #4716)

Core

Introduce $.mobile.supportsTouch as a supported API and resuscitated $.support.touch though it is still unsupported

Moving to jQuery 1.8 as the default version
– jQuery 1.8 (1.8.1) ist now the default version for jQuery Mobile 1.2.x

Reference widget factory version (Issue: #2838)
– jQuery UI’s widget file includes its actual version now.

Download Manager

CSS metadata were pointing at jquery.mobile.transitions.*
– Fix for the jQuery Mobile download manager.

Fixed CSS path had an extra dotdot
– Path fix for the jQuery Mobile download manager.

Grid

Grid CSS refactoring (Issue: #4835)
– Grids with more than two columns and multiple rows now get the correct CSS. Thanks diamondq!

Listview

Add extra listview autodivider check (Issue: #4901)
– If a listview was nested inside a normal list then the listviewcreate event for autodividers would also fire for the parent list causing an error as this list did not contain listview data. An extra check was added to ensure the parent list is actually a listview. Thanks marcins!

Added a “listviewbeforefilter” event (Issue: #4721)
– Listview filter function improvement.

Added filter input as a data attribute of the event

Always filter the full list of items (Issue: #4133)
– Custom filter methods for listviews now always filter all list items.

Listview autodividers: Fix for text links in list items
– Autodividers now work as expected if list items contain links.

Navbar

Capture and retrigger clicks on the parent list item element in navbars (Issue: #4663)
– Fix for an issue on chrome/android where buttons in navbars are functionless after scroll.

Move active state regain code out of _create() and into its own prototype-level function and use ._on() to invoke it during “pagebeforeshow”

Persistent navbar broken on scroll, Chrome for Android. (Issue: #4663)
– Persistent navbars now work as expected. Thanks mmavko!

Navigation

Avoid string concat where possible
– Code refining.

Handle URLs with parentheses properly (Issue: #4849)
– The regular expression used to parse the jqmData psuedo selector restricts the
use of parentheses which are valid in urls. This breaks data-ns-url selection.
The fix is to avoid the pseudo selector.

Make sure the username and password in the url are encoded (Issue: #4787)

Overwrite stale dialog urlHistory entry instead of reusing it as-is (Issue: Replace location.href references with a centralized method so we can address a XSS/cross-site-scripting issue (Issue: #4787)

Strip authority to avoid exploits in parse regex (Issue: #4787)
– As explained by @mala in Issue #4787, most browsers simply strip the authority from `location.href` anyway. We can simply mimick this more secure behavior for the browsers that don’t thereby avoiding the decoding XSS.

Popup

Add afteropen trigger to setTimeout with android fix
– The select menu’s (now that they depend on popups) require that the first item is focused after they are open. The focus of the popup itself was deferred until after the trigger of afteropen which the select menu uses to focus its first item. As a result the focus was stolen from the select menu by the popup to the popup container.

Bind vclick handler to the document on Android
– To implement click-on-screen-to-dismiss-popup one must bind the “vclick” handler to the document rather than the screen, in order to prevent unpleasantness on Android 4.0. WP7 nevertheless requires the code to remain as is, because handling the screen vclick after it has bubbled to the document causes text and inputs underneath the screen to handle and then swallow the event.

Disable popup history managment in old IE by default (Issue: #4784)
– Cause of a Windows Phone 7 (WP7) scroll position caching issue, the new popup history option is disbaled by default for old IE browsers.

Do not allow the event to bubble up to the document, after all
– Refactoring the popup close process to stop bubbling up to the document.

Do not fiddle with the focus when rapid-opening/closing during reposition (Issue: #4797)
– Fix for a native keyboard issue preventing data-input in forms in popups when popup-reposition occurs.

Eliminate the need for a popup IE6/7-specific workaround class, as well as additional scripting
– Popup background fix for IE6/7.

Enable close button when history is disabled
– Make the popup close button work even if the new popup history option is disabled.

First pass at disabling history with an option in popup
– Added a popup option for disabling URL history management. This new option sets whether to alter the URL when a popup is open to support the browsers back button. URL history management is enabled by default.

First pass at popup simplification
– Refactoring popup code for simplification.

Fixed the order of the tolerance parameters (Issue: #4856)
– The values for the popup tolerance option to set the distance between the popup and the window, now were interpreted as the documention says: top, right, bottom, left.

Focus parent link on close when opened by a parent link
– Popup calling links now get focus back when popup closed.

Hide fixed toolbars on Android ICS native browser when popups are opened (Issues: #4816 #4844 #4874)
– When fixed toolbars were used on a page, the use of any position:fixed elements cause havoc with rendering of stacked elements in Android. In these situations, the popup would visually appear *under* the overlay but was still clickable so this was a display bug. This issues were addressed by adding conditional logic that will toggle the toolbars from position:fixed to position:absolute when the popup is opened and closed. The drawback to this fix is fixed toolbars appear to hide when a popup is open, but this workaround is only applied to Android 4.0 and will only been seen if there are fixed toolbars and popups with an overlay theme.

Make sure the popup is closed on destroy (including cleanup)
– Popup code refactoring

On WP7, you get “” for an empty background, not undefined, like in IE8
– Fix for a WP7 popup issue.

Properly handle popups in dialogs, make sure dialog closes on page changes
– Refactoring popup chaining from dialogs to keep proper page navigation and URL history.

Remove default fade animation from popup overlays. (Issue: #4915)
– The CSS-based fade in/out transition on the themed overlay causes similar visual stacking bugs as fixed toolbars in Chrome. This was addressed by removing the fade behavior on the overlay. Testing revealed that not animating the opacity of the overlay made the popup display significantly faster so this change is now applied across the board. The overlay now pops into place without a transition.

Remove link focus, unwind stack before applying focus and tabindex
– To prevent popup transition issues on Android 4.0 devices, the order of applying focus and tabindex was changed when popups are opened.

Remove styles related to popup overlay fade
– Tidied up popup CSS after removing overlay-transitions.

Resolve the popup screen deferred immediately
– Popup refactoring.

The popup screen leaves a 1px gap at the bottom of the screen to avert Android 4.0 hangage
– Popups now get a 1 Pixel bottom gap due to an display issue on Android 4.0.

Unhook hash listeners from popup when aborting

Use just the hash as a selector in IE7/WP 7.0 (Issue: #4917)
– Fixed an IE7/Windows Phone 7.0 popup open issue caused by the handling of hashes and absolute hrefs in that browsers.

Use new ._on() binding method to attach handlers such that they are removed upon _destroy()

Use ui-overlay-* for overlay theme
– Popups overlay now use the ui-overlay class

Use widget factory to trigger events

Slider

Correct slider to use _on, and guard the unbinding test

Merge branch ‘memory-leaks’
– Slider widget functional and memory improvements

Move _preventDocumentDrag function into the widget prototype and attach it with ._on() to ensure removal upon destroy()

Move _sliderMouseUp function into the widget prototype and attach it with ._on() to ensure removal upon destroy()

Partly fixes an issue on Safari/Mac where the input width is decreased when the browser implements the spinner

Textinput

Move _keyup function into the widget prototype and attach it with ._on() to ensure removal upon destroy()

Unbind document handlers to prevent memory leaks on textinput

Toolbar

A negative indent of -99999em can cause native Android 4.x to freak out, since its so absurdly high. Switched to -9999px.

Prevent `0` from being appended to the document when using a persistent footer with jQuery 1.8.x (Issue: #4887)

Widget Factory

Upgrade widget factory to 1.9 beta version (Issue: #4629)

Download

CDN-Hosted JavaScript:

CDN-Hosted CSS:

Copy-and-Paste Snippet for CDN-hosted files (recommended):

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.css" />
<script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.js"></script>

ZIP File:
If you want to host the files yourself you can download a zip of all the files:

Microsoft CDN hosted jQuery Mobile files:

Fork jQuery Mobile on GitHub
https://github.com/jquery/jquery-mobile

18 thoughts on “jQuery Mobile 1.2 Beta Released

  1. Izhar Samuel on said:

    Hi,
    you wrote the beta version works with JQuery v1.8.1, but in the ”
    Copy-and-Paste Snippet for CDN-hosted files (recommended):” you wrote “jquery-1.7.1”

    What is the right link?

  2. Esteban Saa on said:

    Page transitions feel choppy on an Ipad 3, after tap the screen flickers for a ms. Will test further and try to provide a more accurate description.

  3. Adam Procter on said:

    Not sure where to put bugs ? Opening Externally linked (ajax=false) Dialogs do not display correcting when using JQM 1.2.0 Beta & JQ 1.8.1 in PhoneGap – however reverting to JQM 1.2.0 Alpha or JQ 1.7.2 fixes

  4. Elderov Ali on said:

    some problem with jqm1.2 and popup… even opened will start with pageinit, but not if i open popup…. why??

  5. Eduardo Alvarez on said:

    theres a big bug with popups, you cant have popups on multiple pages in a single index.html because every section has a hashtag # (example #home, #pictures, #messages) and inside a popup in every page because it does not work on ipad (safari) nor chrome (pc) because you would have double hash tag (#pictures#popup)

  6. Carpe Temporem on said:

    Much better compared to the alpha- I’m using it with jquery 1.8.1 and Phonegap / Cordova 2.0. But: it is very slow. On my testdevices (Samung Galaxy S3 and S2, Blackberry Playbook) some buttons need about 5 seconds to react. Compared to jquery mobile 1.1 this is incredible slow. I know, 1.2 is experimental – just wanted to report. Anyway: jquery mobile is great, keep it up! 🙂

  7. hi nice improvement but on android 2.3.6 after the navbar the listview / splitview is broken in portrait view (its on the right site out of the screen) … was working perfekt in 1.1.1 final

  8. I’m experiencing instable swipe event on latest jquery-mobile. If I revert to 1.1.1 or 1.1.0 swipe works fine but if I use latest it only fires one in 5 tries. just have a simple .swiperight(function() {}) on a button:
    $(‘a’).click(…).swiperight(…).button().appendTo(‘#x’). Oh forgot to say it only happens in Android ICS native browser

  9. legionpro on said:

    get a new problem right now that were not previously
    the problem is in IE8 only (it is ok in chrome,firefox,safari)
    Page with popup does not appear – just a wheel

  10. John C Kendall on said:

    Thanks for the hard work. However, had to switch back to alpha due to two issues: 1. role=’footer’ elements have a outerHeight of 0 which is throwing off iscroll calcs. 2. Somehow, even though I have the default page transition set to ‘none’, i’m still getting the fade transition.

  11. Ward Peeters on said:

    I still have problems with $(“[data-role=’header’]”, currentPage).fixedtoolbar(); The position absolute or any other not static positioned are not showing at all, works fine on older androids or 4.1. just not 4.0.3

  12. I have found something that I believe to be a bug. I don’t know if it is due to popups, or lists, but if someone would take a look I would appreciate it. I can’t find anything wrong with the generated html. But, it displays wrong on Chrome for Windows and Chrome for Android (Not test others)

    http://tom.am/dev/bible2/index.php

    The bug is seen in clicking “Passage” then “New Testament” or “Apocrypha”, then see the top row. The Old Testament list works but the others don’t for some reason. The top row has the first item link to the last item of the previous list, while the icon at the end of the first list item links to, and has tooltip for, what it is supposed to link to. It also seems to default the theme of the icon.

    If someone finds a solution, or if it turns out I did find a bug, please let me know. Email: tom at tom.am

  13. not sure if this can be solved but the map and video popups don’t work in ie7….. I know ie7 is old and not very good at all but the rest of the framework works. A page with a video or map popup just won’t load, think it is to do with iFrame embed code!?