mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-11 16:13:11 +00:00
Merge remote branch 'origin/master'
This commit is contained in:
commit
8447cc5f88
8 changed files with 83 additions and 36 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 ) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -23,17 +23,25 @@
|
|||
<ol id="qunit-tests">
|
||||
</ol>
|
||||
|
||||
<div id="qunit-fixture">
|
||||
<div data-nstest-role="page">
|
||||
<div data-nstest-role="content">
|
||||
<div data-nstest-role="fieldcontain">
|
||||
<fieldset data-nstest-role="controlgroup">
|
||||
<legend>Agree to the terms:</legend>
|
||||
<input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" />
|
||||
<label for="checkbox-1">I agree</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div data-nstest-role="page">
|
||||
<div data-nstest-role="content">
|
||||
<div data-nstest-role="fieldcontain">
|
||||
<fieldset data-nstest-role="controlgroup">
|
||||
<legend>Agree to the terms:</legend>
|
||||
<input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom"/>
|
||||
<label for="checkbox-1">I agree</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div data-nstest-role="fieldcontain">
|
||||
<fieldset data-nstest-role="controlgroup">
|
||||
<legend>Agree to the terms:</legend>
|
||||
<input type="checkbox" name="checkbox-2" id="checkbox-2" class="custom"/>
|
||||
<label for="checkbox-2">I agree</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
1.0beta-pre
|
||||
1.0a4.1
|
||||
Loading…
Reference in a new issue