@@ -509,7 +509,7 @@ describe('$compile', function() {
509
509
} ) ) ;
510
510
511
511
// NOTE: This test may be redundant.
512
- // Support: Edge 14+
512
+ // Support: Edge 14-15 +
513
513
// An `<svg>` element inside a `<foreignObject>` element on MS Edge has no
514
514
// size, causing the included `<circle>` element to also have no size and thus fails an
515
515
// assertion (relying on the element having a non-zero size).
@@ -760,36 +760,26 @@ describe('$compile', function() {
760
760
element = $compile ( '<div factory-error template-error linking-error></div>' ) ( $rootScope ) ;
761
761
expect ( $exceptionHandler . errors [ 0 ] ) . toEqual ( 'FactoryError' ) ;
762
762
expect ( $exceptionHandler . errors [ 1 ] [ 0 ] ) . toEqual ( 'TemplateError' ) ;
763
- expect ( ie ( $exceptionHandler . errors [ 1 ] [ 1 ] ) ) .
764
- toEqual ( '<div factory-error linking-error template-error>' ) ;
763
+ expect ( sortTag ( $exceptionHandler . errors [ 1 ] [ 1 ] ) ) .
764
+ toEqual ( '<div factory-error="" linking-error="" template-error="" >' ) ;
765
765
expect ( $exceptionHandler . errors [ 2 ] [ 0 ] ) . toEqual ( 'LinkingError' ) ;
766
- expect ( ie ( $exceptionHandler . errors [ 2 ] [ 1 ] ) ) .
767
- toEqual ( '<div class="ng-scope" factory-error linking-error template-error>' ) ;
768
-
769
-
770
- // crazy stuff to make IE happy
771
- function ie ( text ) {
772
- var list = [ ] ,
773
- parts , elementName ;
774
-
775
- parts = lowercase ( text ) .
776
- replace ( '<' , '' ) .
777
- replace ( '>' , '' ) .
778
- split ( ' ' ) ;
766
+ expect ( sortTag ( $exceptionHandler . errors [ 2 ] [ 1 ] ) ) .
767
+ toEqual ( '<div class="ng-scope" factory-error="" linking-error="" template-error="">' ) ;
768
+
769
+ // Support: IE 9-11 only, Edge 15+
770
+ // IE/Edge sort attributes in a different order.
771
+ function sortTag ( text ) {
772
+ var parts , elementName ;
773
+
774
+ parts = text
775
+ . replace ( '<' , '' )
776
+ . replace ( '>' , '' )
777
+ . split ( ' ' ) ;
779
778
elementName = parts . shift ( ) ;
780
779
parts . sort ( ) ;
781
780
parts . unshift ( elementName ) ;
782
- forEach ( parts , function ( value ) {
783
- if ( value . substring ( 0 , 2 ) !== 'ng' ) {
784
- value = value . replace ( '=""' , '' ) ;
785
- var match = value . match ( / = ( .* ) / ) ;
786
- if ( match && match [ 1 ] . charAt ( 0 ) !== '"' ) {
787
- value = value . replace ( / = ( .* ) / , '="$1"' ) ;
788
- }
789
- list . push ( value ) ;
790
- }
791
- } ) ;
792
- return '<' + list . join ( ' ' ) + '>' ;
781
+
782
+ return '<' + parts . join ( ' ' ) + '>' ;
793
783
}
794
784
} ) ;
795
785
} ) ;
@@ -3369,13 +3359,13 @@ describe('$compile', function() {
3369
3359
it ( 'should translate {{}} in terminal nodes' , inject ( function ( $rootScope , $compile ) {
3370
3360
element = $compile ( '<select ng:model="x"><option value="">Greet {{name}}!</option></select>' ) ( $rootScope ) ;
3371
3361
$rootScope . $digest ( ) ;
3372
- expect ( sortedHtml ( element ) . replace ( ' selected="true "' , '' ) ) .
3362
+ expect ( sortedHtml ( element ) . replace ( ' selected="selected "' , '' ) ) .
3373
3363
toEqual ( '<select ng:model="x">' +
3374
3364
'<option value="">Greet !</option>' +
3375
3365
'</select>' ) ;
3376
3366
$rootScope . name = 'Misko' ;
3377
3367
$rootScope . $digest ( ) ;
3378
- expect ( sortedHtml ( element ) . replace ( ' selected="true "' , '' ) ) .
3368
+ expect ( sortedHtml ( element ) . replace ( ' selected="selected "' , '' ) ) .
3379
3369
toEqual ( '<select ng:model="x">' +
3380
3370
'<option value="">Greet Misko!</option>' +
3381
3371
'</select>' ) ;
0 commit comments