diff --git a/docs/component-spec/mocks.js b/docs/component-spec/mocks.js index f916c0edee7a..502c0cd2bea4 100644 --- a/docs/component-spec/mocks.js +++ b/docs/component-spec/mocks.js @@ -1,5 +1,5 @@ // Copy/pasted from src/Angular.js, so that we can disable specific tests on IE. -var msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1], 10); +var msie = document.documentMode; var createMockWindow = function() { var mockWindow = {}; diff --git a/src/Angular.js b/src/Angular.js index 740cd6911427..43c54bf70c2d 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -75,13 +75,9 @@ var /** holds major version number for IE or NaN for real browsers */ uid = ['0', '0', '0']; /** - * IE 11 changed the format of the UserAgent string. - * See http://msdn.microsoft.com/en-us/library/ms537503.aspx + * document.documentMode is IE specific and returns IE document Mode for current page. */ -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 3da6d5eae9b7..44b0783fde91 100644 --- a/src/ngScenario/browserTrigger.js +++ b/src/ngScenario/browserTrigger.js @@ -1,7 +1,7 @@ 'use strict'; (function() { - var msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1], 10); + var msie = document.documentMode; function indexOf(array, obj) { if (array.indexOf) return array.indexOf(obj); diff --git a/test/ngTouch/directive/ngSwipeSpec.js b/test/ngTouch/directive/ngSwipeSpec.js index a7869a36639f..2628ea39b00d 100644 --- a/test/ngTouch/directive/ngSwipeSpec.js +++ b/test/ngTouch/directive/ngSwipeSpec.js @@ -17,7 +17,7 @@ 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]); + var msie = document.documentMode; if (msie < 9) { return; } diff --git a/test/ngTouch/swipeSpec.js b/test/ngTouch/swipeSpec.js index 435dda8c0109..fbc8723c1a4f 100644 --- a/test/ngTouch/swipeSpec.js +++ b/test/ngTouch/swipeSpec.js @@ -17,7 +17,7 @@ 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]); + var msie = document.documentMode; if (msie < 9) { return; }