-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix initialization when dpointer loaded before document.body exists.
Remove vestigial code for "-ms-touch-action" (IE10 is no longer supported). Fix harmless (but useless) double-creation of CSS rule, refs #30. Fix has("touch-device") to be true on iPad with iOS 13. Note though that iOS and Mac now finally support pointer events natively, so this library has mostly outlived its usefulness.
- Loading branch information
Showing
3 changed files
with
13 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
/** | ||
* | ||
* Feature detection tests. | ||
*/ | ||
define([ | ||
"requirejs-dplugins/has" | ||
], function (has) { | ||
if (typeof document !== "undefined") { | ||
has.add("touch-events", "ontouchstart" in document); // UA supports Touch Events | ||
has.add("pointer-events", "onpointerdown" in document); // UA supports Pointer Events | ||
has.add("touch-device", /(mobile)|(android)/i.test(navigator.userAgent)); // mobile device | ||
has.add("css-touch-action", "touchAction" in document.body.style);// touch-action CSS | ||
has.add("css-ms-touch-action", "msTouchAction" in document.body.style);// -ms-touch-action CSS | ||
|
||
// Mobile device | ||
// Special test for iOS 13.1+, to counteract misleading userAgent string. | ||
var ios13 = /Safari/.test(navigator.userAgent) && "ontouchstart" in document; | ||
has.add("touch-device", /(mobile)|(android)/i.test(navigator.userAgent) || ios13); // mobile device | ||
|
||
has.add("css-touch-action", "touchAction" in document.createElement("div").style); | ||
} | ||
|
||
return has; | ||
}); |