Skip to content

Commit

Permalink
Introduced $.mobile.supportsTouch as a supported API and resuscitated…
Browse files Browse the repository at this point in the history
… $.support.touch though it is still unsupported.

Fixes jquery-archive#4786
  • Loading branch information
gseguin authored and arschmitz committed Oct 16, 2012
1 parent e2d91d4 commit 5ddd64a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/events/touch.js
Expand Up @@ -3,7 +3,7 @@
//>>label: touch
//>>group: Events

define( [ "jquery", "../jquery.mobile.vmouse" ], function( $ ) {
define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");

(function( $, window, undefined ) {
Expand All @@ -23,7 +23,7 @@ define( [ "jquery", "../jquery.mobile.vmouse" ], function( $ ) {
}
});

var supportTouch = "ontouchend" in document,
var supportTouch = $.mobile.supportsTouch,
scrollEvent = "touchmove scroll",
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
touchStopEvent = supportTouch ? "touchend" : "mouseup",
Expand Down
1 change: 1 addition & 0 deletions js/index.php
Expand Up @@ -9,6 +9,7 @@
'jquery.ui.widget.js',
'jquery.mobile.widget.js',
'jquery.mobile.media.js',
'jquery.mobile.support.touch.js',
'jquery.mobile.support.orientation.js',
'jquery.mobile.support.js',
'jquery.mobile.vmouse.js',
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.mobile.support.js
Expand Up @@ -2,7 +2,7 @@
//>>description: Assorted tests to qualify browsers by detecting features
//>>label: Support Tests
//>>group: Core
define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.media", "./jquery.mobile.support.orientation" ], function( $ ) {
define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.media", "./jquery.mobile.support.touch", "./jquery.mobile.support.orientation" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {

Expand Down
18 changes: 18 additions & 0 deletions js/jquery.mobile.support.touch.js
@@ -0,0 +1,18 @@
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Touch feature test
//>>label: Touch support test
//>>group: Core

define( [ "jquery" ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
$.extend( $.support, {
touch: "ontouchend" in document
});
$.extend( $.mobile, {
supportsTouch: $.support.touch
});
}( jQuery ));
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");

0 comments on commit 5ddd64a

Please sign in to comment.