diff options
Diffstat (limited to 'src/ng/sniffer.js')
| -rw-r--r-- | src/ng/sniffer.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ng/sniffer.js b/src/ng/sniffer.js index eebb2903..3249b816 100644 --- a/src/ng/sniffer.js +++ b/src/ng/sniffer.js @@ -12,13 +12,23 @@ * @description * This is very simple implementation of testing browser's features. */ -function $SnifferProvider(){ - this.$get = ['$window', function($window){ +function $SnifferProvider() { + this.$get = ['$window', function($window) { + var eventSupport = {}; + return { history: !!($window.history && $window.history.pushState), hashchange: 'onhashchange' in $window && // IE8 compatible mode lies - (!$window.document.documentMode || $window.document.documentMode > 7) + (!$window.document.documentMode || $window.document.documentMode > 7), + hasEvent: function(event) { + if (isUndefined(eventSupport[event])) { + var divElm = $window.document.createElement('div'); + eventSupport[event] = 'on' + event in divElm; + } + + return eventSupport[event]; + } }; }]; } |
