moved check/uncheck event on label to touchend/mouseup. Fixes #753

This commit is contained in:
scottjehl 2011-01-21 17:45:22 -05:00
parent a1cb31a2c7
commit 38c1c24e5d

View file

@ -10,7 +10,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
theme: null
},
_create: function(){
var input = this.element,
var self = this,
input = this.element,
label = input.closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"),
inputtype = input.attr( "type" ),
checkedicon = "ui-icon-" + inputtype + "-on",
@ -40,18 +41,13 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
if( $(this).parent().is('.ui-disabled') ){ return false; }
},
mousedown: function() {
if( $(this).parent().is('.ui-disabled') ){ return false; }
label.data( "state", input.attr( "checked" ) );
},
click: false
click: function() {
setTimeout(function() {
if ( input.attr( "checked" ) === label.data( "state" ) ) {
input.trigger( "click" );
}
}, 1);
}
})
.bind( $.support.touch ? "touchend" : "mouseup", function(){
if( $(this).parent().is('.ui-disabled') ){ return false; }
input.attr( "checked", !input.is( ":checked" ) );
self.refresh();
});
input