This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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 @@ -1507,7 +1507,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1507
1507
if ( parentGet . literal ) {
1508
1508
compare = equals ;
1509
1509
} else {
1510
- compare = function ( a , b ) { return a === b ; } ;
1510
+ compare = function ( a , b ) { return a === b || ( a !== a && b !== b ) ; } ;
1511
1511
}
1512
1512
parentSet = parentGet . assign || function ( ) {
1513
1513
// reset the change, or we will throw this exception on every $digest
Original file line number Diff line number Diff line change @@ -2869,6 +2869,28 @@ describe('$compile', function() {
2869
2869
} ) ;
2870
2870
2871
2871
2872
+ it ( 'should update parent scope when "="-bound NaN changes' , inject ( function ( $compile , $rootScope ) {
2873
+ $rootScope . num = NaN ;
2874
+ compile ( '<div my-component reference="num"></div>' ) ;
2875
+ var isolateScope = element . isolateScope ( ) ;
2876
+ expect ( isolateScope . reference ) . toBeNaN ( ) ;
2877
+
2878
+ isolateScope . $apply ( function ( scope ) { scope . reference = 64 ; } ) ;
2879
+ expect ( $rootScope . num ) . toBe ( 64 ) ;
2880
+ } ) ) ;
2881
+
2882
+
2883
+ it ( 'should update isolate scope when "="-bound NaN changes' , inject ( function ( $compile , $rootScope ) {
2884
+ $rootScope . num = NaN ;
2885
+ compile ( '<div my-component reference="num"></div>' ) ;
2886
+ var isolateScope = element . isolateScope ( ) ;
2887
+ expect ( isolateScope . reference ) . toBeNaN ( ) ;
2888
+
2889
+ $rootScope . $apply ( function ( scope ) { scope . num = 64 ; } ) ;
2890
+ expect ( isolateScope . reference ) . toBe ( 64 ) ;
2891
+ } ) ) ;
2892
+
2893
+
2872
2894
describe ( 'bind-once' , function ( ) {
2873
2895
2874
2896
function countWatches ( scope ) {
You can’t perform that action at this time.
0 commit comments