This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 5 files changed +31
-6
lines changed
5 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ if ('i' !== 'I'.toLowerCase()) {
58
58
59
59
60
60
var /** holds major version number for IE or NaN for real browsers */
61
- msie = int ( ( / m s i e ( \d + ) / . exec ( lowercase ( navigator . userAgent ) ) || [ ] ) [ 1 ] ) ,
61
+ msie ,
62
62
jqLite , // delay binding since jQuery could be loaded after us.
63
63
jQuery , // delay binding
64
64
slice = [ ] . slice ,
@@ -74,6 +74,16 @@ var /** holds major version number for IE or NaN for real browsers */
74
74
nodeName_ ,
75
75
uid = [ '0' , '0' , '0' ] ;
76
76
77
+ /**
78
+ * IE 11 changed the format of the UserAgent string.
79
+ * See http://msdn.microsoft.com/en-us/library/ms537503.aspx
80
+ */
81
+ msie = int ( ( / m s i e ( \d + ) / . exec ( lowercase ( navigator . userAgent ) ) || [ ] ) [ 1 ] ) ;
82
+ if ( isNaN ( msie ) ) {
83
+ msie = int ( ( / t r i d e n t \/ .* ; r v : ( \d + ) / . exec ( lowercase ( navigator . userAgent ) ) || [ ] ) [ 1 ] ) ;
84
+ }
85
+
86
+
77
87
/**
78
88
* @private
79
89
* @param {* } obj
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ function $$UrlUtilsProvider() {
75
75
*/
76
76
function resolve ( url , parse ) {
77
77
var href = url ;
78
- if ( msie ) {
78
+ if ( msie <= 11 ) {
79
79
// Normalize before parse. Refer Implementation Notes on why this is
80
80
// done in two steps on IE.
81
81
urlParsingNode . setAttribute ( "href" , href ) ;
Original file line number Diff line number Diff line change @@ -1003,4 +1003,19 @@ describe('angular', function() {
1003
1003
} ) ;
1004
1004
} ) ;
1005
1005
1006
+ describe ( 'msie UA parsing' , function ( ) {
1007
+ if ( / T r i d e n t \/ .* ; r v : / . test ( window . navigator . userAgent ) ) {
1008
+ it ( 'should fail when the Trident and the rv versions disagree for IE11+' , function ( ) {
1009
+ // When this test fails, we can think about whether we want to use the version from the
1010
+ // Trident token in the UA string or stick with the version from rv: as we currently do.
1011
+ // Refer https://github.com/angular/angular.js/pull/3758#issuecomment-23529245 for the
1012
+ // discussion.
1013
+ var UA = window . navigator . userAgent ;
1014
+ var tridentVersion = parseInt ( ( / T r i d e n t \/ ( \d + ) / . exec ( UA ) || [ ] ) [ 1 ] , 10 ) + 4 ;
1015
+ var rvVersion = parseInt ( ( / T r i d e n t \/ .* ; r v : ( \d + ) / . exec ( UA ) || [ ] ) [ 1 ] , 10 ) ;
1016
+ expect ( tridentVersion ) . toBe ( rvVersion ) ;
1017
+ } ) ;
1018
+ }
1019
+ } ) ;
1020
+
1006
1021
} ) ;
Original file line number Diff line number Diff line change @@ -2897,7 +2897,7 @@ describe('$compile', function() {
2897
2897
} ) ) ;
2898
2898
2899
2899
2900
- // Fails on IE < 10 with "TypeError: Access is denied" when trying to set img[src]
2900
+ // Fails on IE <= 10 with "TypeError: Access is denied" when trying to set img[src]
2901
2901
if ( ! msie || msie > 10 ) {
2902
2902
it ( 'should sanitize mailto: urls' , inject ( function ( $compile , $rootScope ) {
2903
2903
element = $compile ( '<img src="{{testUrl}}"></a>' ) ( $rootScope ) ;
@@ -3008,9 +3008,9 @@ describe('$compile', function() {
3008
3008
inject ( function ( $compile , $rootScope ) {
3009
3009
element = $compile ( '<img src="{{testUrl}}"></img>' ) ( $rootScope ) ;
3010
3010
3011
- // Fails on IE < 10 with "TypeError: Object doesn't support this property or method" when
3011
+ // Fails on IE <= 11 with "TypeError: Object doesn't support this property or method" when
3012
3012
// trying to set img[src]
3013
- if ( ! msie || msie > 10 ) {
3013
+ if ( ! msie || msie > 11 ) {
3014
3014
$rootScope . testUrl = "javascript:doEvilStuff()" ;
3015
3015
$rootScope . $apply ( ) ;
3016
3016
expect ( element . attr ( 'src' ) ) . toBe ( 'javascript:doEvilStuff()' ) ;
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ describe('$sniffer', function() {
112
112
else if ( / f i r e f o x / i. test ( ua ) ) {
113
113
expectedPrefix = 'Moz' ;
114
114
}
115
- else if ( / i e / i. test ( ua ) ) {
115
+ else if ( / i e / i. test ( ua ) || / t r i d e n t / i . test ( ua ) ) {
116
116
expectedPrefix = 'Ms' ;
117
117
}
118
118
else if ( / o p e r a / i. test ( ua ) ) {
You can’t perform that action at this time.
0 commit comments