File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -1474,7 +1474,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1474
1474
if ( parentGet . literal ) {
1475
1475
compare = equals ;
1476
1476
} else {
1477
- compare = function ( a , b ) { return a === b ; } ;
1477
+ compare = function ( a , b ) { return a === b || ( a !== a && b !== b ) ; } ;
1478
1478
}
1479
1479
parentSet = parentGet . assign || function ( ) {
1480
1480
// reset the change, or we will throw this exception on every $digest
Original file line number Diff line number Diff line change @@ -2671,6 +2671,28 @@ describe('$compile', function() {
2671
2671
} ) ;
2672
2672
2673
2673
2674
+ it ( 'should update parent scope when "="-bound NaN changes' , inject ( function ( $compile , $rootScope ) {
2675
+ $rootScope . num = NaN ;
2676
+ compile ( '<div my-component reference="num"></div>' ) ;
2677
+ var isolateScope = element . isolateScope ( ) ;
2678
+ expect ( isolateScope . reference ) . toBeNaN ( ) ;
2679
+
2680
+ isolateScope . $apply ( function ( scope ) { scope . reference = 64 ; } ) ;
2681
+ expect ( $rootScope . num ) . toBe ( 64 ) ;
2682
+ } ) ) ;
2683
+
2684
+
2685
+ it ( 'should update isolate scope when "="-bound NaN changes' , inject ( function ( $compile , $rootScope ) {
2686
+ $rootScope . num = NaN ;
2687
+ compile ( '<div my-component reference="num"></div>' ) ;
2688
+ var isolateScope = element . isolateScope ( ) ;
2689
+ expect ( isolateScope . reference ) . toBeNaN ( ) ;
2690
+
2691
+ $rootScope . $apply ( function ( scope ) { scope . num = 64 ; } ) ;
2692
+ expect ( isolateScope . reference ) . toBe ( 64 ) ;
2693
+ } ) ) ;
2694
+
2695
+
2674
2696
describe ( 'attribute' , function ( ) {
2675
2697
it ( 'should copy simple attribute' , inject ( function ( ) {
2676
2698
compile ( '<div><span my-component attr="some text">' ) ;
You can’t perform that action at this time.
0 commit comments