diff --git a/src/Angular.js b/src/Angular.js index aa549c68740f..cb5ca9a95ae5 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -171,13 +171,10 @@ var /** holds major version number for IE or NaN for real browsers */ uid = 0; /** - * IE 11 changed the format of the UserAgent string. - * See http://msdn.microsoft.com/en-us/library/ms537503.aspx + * documentMode is an IE-only property + * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx */ -msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]); -if (isNaN(msie)) { - msie = int((/trident\/.*; rv:(\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]); -} +msie = document.documentMode; /** diff --git a/src/ngScenario/browserTrigger.js b/src/ngScenario/browserTrigger.js index 478853e28512..1535d4432647 100644 --- a/src/ngScenario/browserTrigger.js +++ b/src/ngScenario/browserTrigger.js @@ -1,7 +1,11 @@ 'use strict'; (function() { - var msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1], 10); + /** + * documentMode is an IE-only property + * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx + */ + msie = document.documentMode; /** * Triggers a browser event. Attempts to choose the right event if one is diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 356d2a36167f..c07a59e01253 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -1185,7 +1185,8 @@ describe('jqLite', function() { if (window.jQuery) return; var browserMoveTrigger = function(from, to){ var fireEvent = function(type, element, relatedTarget){ - var evnt, msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]); + var evnt; + if (msie < 9){ evnt = document.createEventObject(); evnt.srcElement = element; diff --git a/test/ngTouch/directive/ngSwipeSpec.js b/test/ngTouch/directive/ngSwipeSpec.js index 5b8fa7537dd5..43d49b43097d 100644 --- a/test/ngTouch/directive/ngSwipeSpec.js +++ b/test/ngTouch/directive/ngSwipeSpec.js @@ -14,14 +14,6 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, } } - // Skip tests on IE < 9. These versions of IE don't support createEvent(), and so - // we cannot control the (x,y) position of events. - // It works fine in IE 8 under manual testing. - var msie = +((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]); - if (msie < 9) { - return; - } - beforeEach(function() { module('ngTouch'); }); diff --git a/test/ngTouch/swipeSpec.js b/test/ngTouch/swipeSpec.js index daa5a73f92df..416d9f5d632d 100644 --- a/test/ngTouch/swipeSpec.js +++ b/test/ngTouch/swipeSpec.js @@ -4,14 +4,6 @@ describe('$swipe', function() { var element; var events; - // Skip tests on IE < 9. These versions of IE don't support createEvent(), and so - // we cannot control the (x,y) position of events. - // It works fine in IE 8 under manual testing. - var msie = +((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]); - if (msie < 9) { - return; - } - beforeEach(function() { module('ngTouch'); inject(function($compile, $rootScope) {