aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/sniffer.js
diff options
context:
space:
mode:
authorMisko Hevery2013-03-20 16:24:23 -0700
committerMisko Hevery2013-04-02 14:05:06 -0700
commit0b6f1ce5f89f47f9302ff1e8cd8f4b92f837c413 (patch)
tree8cbc0c86024dd4f97d0aa54e0c9b7df9b0d56b86 /src/ng/sniffer.js
parent4bfb66ce0be46d3a0e9da2f80f3e1d0c2b559828 (diff)
downloadangular.js-0b6f1ce5f89f47f9302ff1e8cd8f4b92f837c413.tar.bz2
feat(ngAnimate): add support for animation
Diffstat (limited to 'src/ng/sniffer.js')
-rw-r--r--src/ng/sniffer.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/ng/sniffer.js b/src/ng/sniffer.js
index 9342fbd5..19877b87 100644
--- a/src/ng/sniffer.js
+++ b/src/ng/sniffer.js
@@ -9,6 +9,7 @@
*
* @property {boolean} history Does the browser support html5 history api ?
* @property {boolean} hashchange Does the browser support hashchange event ?
+ * @property {boolean} supportsTransitions Does the browser support CSS transition events ?
*
* @description
* This is very simple implementation of testing browser's features.
@@ -16,8 +17,25 @@
function $SnifferProvider() {
this.$get = ['$window', '$document', function($window, $document) {
var eventSupport = {},
- android = int((/android (\d+)/.exec(lowercase($window.navigator.userAgent)) || [])[1]),
- document = $document[0];
+ android = int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
+ document = $document[0] || {},
+ vendorPrefix,
+ vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,
+ bodyStyle = document.body && document.body.style,
+ transitions = false,
+ match;
+
+ if (bodyStyle) {
+ for(var prop in bodyStyle) {
+ if(match = vendorRegex.exec(prop)) {
+ vendorPrefix = match[0];
+ vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
+ break;
+ }
+ }
+ transitions = !!(vendorPrefix + 'Transition' in bodyStyle);
+ }
+
return {
// Android has history.pushState, but it does not update location correctly
@@ -41,7 +59,9 @@ function $SnifferProvider() {
return eventSupport[event];
},
- csp: document.securityPolicy ? document.securityPolicy.isActive : false
+ csp: document.securityPolicy ? document.securityPolicy.isActive : false,
+ vendorPrefix: vendorPrefix,
+ supportsTransitions : transitions
};
}];
}