This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +31
-6
lines changed Expand file tree Collapse file tree 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()) {
5858
5959
6060var /** 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 ,
6262 jqLite , // delay binding since jQuery could be loaded after us.
6363 jQuery , // delay binding
6464 slice = [ ] . slice ,
@@ -74,6 +74,16 @@ var /** holds major version number for IE or NaN for real browsers */
7474 nodeName_ ,
7575 uid = [ '0' , '0' , '0' ] ;
7676
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+
7787/**
7888 * @private
7989 * @param {* } obj
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ function $$UrlUtilsProvider() {
7575 */
7676 function resolve ( url , parse ) {
7777 var href = url ;
78- if ( msie ) {
78+ if ( msie <= 11 ) {
7979 // Normalize before parse. Refer Implementation Notes on why this is
8080 // done in two steps on IE.
8181 urlParsingNode . setAttribute ( "href" , href ) ;
Original file line number Diff line number Diff line change @@ -1003,4 +1003,19 @@ describe('angular', function() {
10031003 } ) ;
10041004 } ) ;
10051005
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+
10061021} ) ;
Original file line number Diff line number Diff line change @@ -2897,7 +2897,7 @@ describe('$compile', function() {
28972897 } ) ) ;
28982898
28992899
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]
29012901 if ( ! msie || msie > 10 ) {
29022902 it ( 'should sanitize mailto: urls' , inject ( function ( $compile , $rootScope ) {
29032903 element = $compile ( '<img src="{{testUrl}}"></a>' ) ( $rootScope ) ;
@@ -3008,9 +3008,9 @@ describe('$compile', function() {
30083008 inject ( function ( $compile , $rootScope ) {
30093009 element = $compile ( '<img src="{{testUrl}}"></img>' ) ( $rootScope ) ;
30103010
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
30123012 // trying to set img[src]
3013- if ( ! msie || msie > 10 ) {
3013+ if ( ! msie || msie > 11 ) {
30143014 $rootScope . testUrl = "javascript:doEvilStuff()" ;
30153015 $rootScope . $apply ( ) ;
30163016 expect ( element . attr ( 'src' ) ) . toBe ( 'javascript:doEvilStuff()' ) ;
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ describe('$sniffer', function() {
112112 else if ( / f i r e f o x / i. test ( ua ) ) {
113113 expectedPrefix = 'Moz' ;
114114 }
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 ) ) {
116116 expectedPrefix = 'Ms' ;
117117 }
118118 else if ( / o p e r a / i. test ( ua ) ) {
You can’t perform that action at this time.
0 commit comments