Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refactor: use document.documentMode to determine msie version #9398

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down
6 changes: 5 additions & 1 deletion src/ngScenario/browserTrigger.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/jqLiteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions test/ngTouch/directive/ngSwipeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down
8 changes: 0 additions & 8 deletions test/ngTouch/swipeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down