diff --git a/docs/pages/docs-pages.html b/docs/pages/docs-pages.html index e23b5191..c05807fe 100755 --- a/docs/pages/docs-pages.html +++ b/docs/pages/docs-pages.html @@ -33,9 +33,9 @@ <html> <head> <title>Page Title</title> - <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" /> + <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script> - <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script> + <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script> </head> <body> @@ -75,9 +75,9 @@ <html> <head> <title>Page Title</title> - <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" /> + <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script> - <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script> + <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script> </head> <body> diff --git a/js/jquery.mobile.collapsible.js b/js/jquery.mobile.collapsible.js index 9bc70c35..cc60e79b 100644 --- a/js/jquery.mobile.collapsible.js +++ b/js/jquery.mobile.collapsible.js @@ -133,15 +133,16 @@ $.widget( "mobile.collapsible", $.mobile.widget, { } collapsibleHeading - .bind("vclick", function(e){ - if( collapsibleHeading.is('.ui-collapsible-heading-collapsed') ){ - collapsibleContain.trigger('expand'); - } - else { - collapsibleContain.trigger('collapse'); - } - e.preventDefault(); - }); + .bind("vmouseup", function(e){ + if( collapsibleHeading.is('.ui-collapsible-heading-collapsed') ){ + collapsibleContain.trigger('expand'); + } + else { + collapsibleContain.trigger('collapse'); + } + e.preventDefault(); + }) + .bind("vclick",false ); } }); })( jQuery ); \ No newline at end of file diff --git a/js/jquery.mobile.event.js b/js/jquery.mobile.event.js index 74fc73b0..592bc35d 100644 --- a/js/jquery.mobile.event.js +++ b/js/jquery.mobile.event.js @@ -81,7 +81,7 @@ $.event.special.tap = { function clearTapHandlers() { touching = false; clearTimeout(timer); - $(this).unbind("vclick", clickHandler).unbind("vmousecancel", clearTapHandlers); + $this.unbind("vclick", clickHandler).unbind("vmousecancel", clearTapHandlers); } function clickHandler(event) { diff --git a/js/jquery.mobile.forms.slider.js b/js/jquery.mobile.forms.slider.js index 39f38af5..689a0ba9 100644 --- a/js/jquery.mobile.forms.slider.js +++ b/js/jquery.mobile.forms.slider.js @@ -132,7 +132,8 @@ $.widget( "mobile.slider", $.mobile.widget, { this.handle .bind( "vmousedown", function(){ $(this).focus(); - }); + }) + .bind( "vclick", false ); this.handle .bind( "keydown", function( event ) { diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index eaa81405..2cf58ff8 100644 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -237,12 +237,20 @@ //direct focus to the page title, or otherwise first focusable element function reFocus( page ){ - var pageTitle = page.find( ".ui-title:eq(0)" ); - if( pageTitle.length ){ - pageTitle.focus(); + var lastClicked = page.jqmData( "lastClicked" ); + + if( lastClicked && lastClicked.length ){ + lastClicked.focus(); } - else{ - page.find( focusable ).eq(0).focus(); + else { + var pageTitle = page.find( ".ui-title:eq(0)" ); + + if( pageTitle.length ){ + pageTitle.focus(); + } + else{ + page.find( focusable ).eq(0).focus(); + } } } @@ -396,13 +404,15 @@ if( from ){ //set as data for returning to that spot - from.jqmData( "lastScroll", currScroll); + from + .jqmData( "lastScroll", currScroll) + .jqmData( "lastClicked", $activeClickedLink); //trigger before show/hide events from.data( "page" )._trigger( "beforehide", null, { nextPage: to } ); } to.data( "page" )._trigger( "beforeshow", null, { prevPage: from || $("") } ); - function loadComplete(){ + function pageChangeComplete(){ if( changeHash !== false && url ){ //disable hash listening temporarily @@ -486,7 +496,7 @@ if( from ){ from.removeClass( $.mobile.activePageClass ); } - loadComplete(); + pageChangeComplete(); removeContainerClasses(); }); } @@ -496,7 +506,7 @@ from.removeClass( $.mobile.activePageClass ); } to.addClass( $.mobile.activePageClass ); - loadComplete(); + pageChangeComplete(); } } @@ -685,6 +695,11 @@ ); event.preventDefault(); }); + + //add active state on vclick + $( "a" ).live( "vclick", function(){ + $(this).closest( ".ui-btn" ).not( ".ui-disabled" ).addClass( $.mobile.activeBtnClass ); + }); //click routing - direct to HTTP or Ajax, accordingly @@ -747,7 +762,7 @@ return; } - $activeClickedLink = $this.closest( ".ui-btn" ).addClass( $.mobile.activeBtnClass ); + $activeClickedLink = $this.closest( ".ui-btn" ); if( isExternal || hasAjaxDisabled || hasTarget || !$.mobile.ajaxEnabled || // TODO: deprecated - remove at 1.0 diff --git a/tests/unit/checkboxradio/checkboxradio_core.js b/tests/unit/checkboxradio/checkboxradio_core.js index 56e5f110..235fe9d9 100644 --- a/tests/unit/checkboxradio/checkboxradio_core.js +++ b/tests/unit/checkboxradio/checkboxradio_core.js @@ -26,4 +26,26 @@ ok(!input.attr("checked"), "not checked after click"); ok(!button.hasClass("ui-btn-active"), "no active styles after click"); }); + + asyncTest( "change events fired on checkbox for both check and uncheck", function(){ + var $checkbox = $("#checkbox-2"), + $checkboxLabel = $("[for=checkbox-2]"); + + $checkbox.unbind("change"); + + expect( 2 ); + + $checkbox.change(function(){ + ok(true, "change fired on click to check the box"); + }); + + $checkboxLabel.trigger("click"); + + //test above will be triggered twice, and the start here once + $checkbox.change(function(){ + start(); + }); + + $checkboxLabel.trigger("click"); + }); })(jQuery); diff --git a/tests/unit/checkboxradio/index.html b/tests/unit/checkboxradio/index.html index 74d31a21..6f324ba0 100644 --- a/tests/unit/checkboxradio/index.html +++ b/tests/unit/checkboxradio/index.html @@ -23,17 +23,25 @@