Permalink
Browse files

Slider: On Opera Mobile event.which is undefined. Accept that and get…

… slidin'. Fixes #5903.
  • Loading branch information...
gabrielschulhof committed Apr 18, 2013
1 parent ab910d3 commit b90361bea87b1f2ab5ee3136cecab68f146ba84f
Showing with 11 additions and 2 deletions.
  1. +1 −1 js/widgets/forms/slider.js
  2. +10 −1 tests/unit/slider/slider_events.js
@@ -268,7 +268,7 @@ $.widget( "mobile.slider", $.mobile.widget, $.extend( {
_sliderVMouseDown: function( event ) {
// NOTE: we don't do this in refresh because we still want to
// support programmatic alteration of disabled inputs
if ( this.options.disabled || !( event.which === 1 || event.which === 0 ) ) {
if ( this.options.disabled || !( event.which === 1 || event.which === 0 || event.which === undefined ) ) {
return false;
}
if ( this._trigger( "beforestart", event ) === false ) {
@@ -375,7 +375,7 @@
});
asyncTest( "drag should start only when clicked with left button", function(){
expect( 4 );
expect( 5 );
var control = $( "#mousedown-which-events" ),
widget = control.data( "mobile-slider" ),
@@ -405,6 +405,15 @@
function( result ) {
deepEqual( result.slidestart.timedOut, false, "slider did emit 'slidestart' event upon left button press" );
event = $.Event( "mousedown", { target: handle[ 0 ] } );
event.which = undefined;
slider.trigger( event );
},
{
slidestart: { src: control, event: "slidestart" + eventNs + "1" }
},
function( result ) {
deepEqual( result.slidestart.timedOut, false, "slider did emit 'slidestart' event upon undefined button press" );
event = $.Event( "mousedown", { target: handle[ 0 ] } );
event.which = 2;
slider.trigger( event );
},

0 comments on commit b90361b

Please sign in to comment.