forked from staaky/strip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupport.js
More file actions
52 lines (42 loc) · 1.55 KB
/
Copy pathsupport.js
File metadata and controls
52 lines (42 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var Support = (function() {
var testElement = document.createElement('div'),
domPrefixes = 'Webkit Moz O ms Khtml'.split(' ');
function prefixed(property){
return testAllProperties(property, 'prefix');
};
function testProperties(properties, prefixed ) {
for ( var i in properties ) {
if (testElement.style[ properties[i] ] !== undefined ) {
return prefixed == 'prefix' ? properties[i] : true;
}
}
return false;
}
function testAllProperties(property, prefixed ) {
var ucProperty = property.charAt(0).toUpperCase() + property.substr(1),
properties = (property + ' ' + domPrefixes.join(ucProperty + ' ') + ucProperty).split(' ');
return testProperties(properties, prefixed);
}
// feature detect
return {
css: {
animation: testAllProperties('animation'),
transform: testAllProperties('transform'),
prefixed: prefixed
},
svg: (!!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect),
touch: (function() {
try {
return !!(('ontouchstart' in window) ||
window.DocumentTouch && document instanceof DocumentTouch); // firefox on Android
} catch (e) {
return false;
}
})()
};
})();
// add mobile touch to support
Support.mobileTouch = Support.touch &&
(Browser.MobileSafari || Browser.Android || Browser.IEMobile || Browser.ChromeMobile
|| !/^(Win|Mac|Linux)/.test(navigator.platform) // otherwise, assume anything not on Windows, Mac or Linux is a mobile device
);