@@ -1080,8 +1080,11 @@ function $ParseProvider() {
10801080 return list ;
10811081 }
10821082
1083- function expressionInputDirtyCheck ( newValue , oldValue ) {
1084- if ( newValue == null || oldValue == null ) return newValue === oldValue ; // null/undefined
1083+ function expressionInputDirtyCheck ( newValue , oldValueOfValue ) {
1084+
1085+ if ( newValue == null || oldValueOfValue == null ) { // null/undefined
1086+ return newValue === oldValueOfValue ;
1087+ }
10851088
10861089 if ( typeof newValue === 'object' ) {
10871090
@@ -1095,13 +1098,11 @@ function $ParseProvider() {
10951098 return false ;
10961099 }
10971100
1098- oldValue = oldValue . valueOf ( ) ;
1099-
11001101 // fall-through to the primitive equality check
11011102 }
11021103
11031104 //Primitive or NaN
1104- return newValue === oldValue || ( newValue !== newValue && oldValue !== oldValue ) ;
1105+ return newValue === oldValueOfValue || ( newValue !== newValue && oldValueOfValue !== oldValueOfValue ) ;
11051106 }
11061107
11071108 function inputsWatchDelegate ( scope , listener , objectEquality , parsedExpression ) {
@@ -1117,24 +1118,24 @@ function $ParseProvider() {
11171118 var newInputValue = inputExpressions ( scope ) ;
11181119 if ( ! expressionInputDirtyCheck ( newInputValue , oldInputValue ) ) {
11191120 lastResult = parsedExpression ( scope ) ;
1120- oldInputValue = newInputValue ;
1121+ oldInputValue = newInputValue . valueOf ( ) ;
11211122 }
11221123 return lastResult ;
11231124 } , listener , objectEquality ) ;
11241125 }
11251126
1126- var oldInputValues = [ ] ;
1127+ var oldInputValueOfValues = [ ] ;
11271128 for ( var i = 0 , ii = inputExpressions . length ; i < ii ; i ++ ) {
1128- oldInputValues [ i ] = expressionInputDirtyCheck ; // init to something unique so that equals check fails
1129+ oldInputValueOfValues [ i ] = expressionInputDirtyCheck ; // init to something unique so that equals check fails
11291130 }
11301131
11311132 return scope . $watch ( function expressionInputsWatch ( scope ) {
11321133 var changed = false ;
11331134
11341135 for ( var i = 0 , ii = inputExpressions . length ; i < ii ; i ++ ) {
11351136 var newInputValue = inputExpressions [ i ] ( scope ) ;
1136- if ( changed || ( changed = ! expressionInputDirtyCheck ( newInputValue , oldInputValues [ i ] ) ) ) {
1137- oldInputValues [ i ] = newInputValue ;
1137+ if ( changed || ( changed = ! expressionInputDirtyCheck ( newInputValue , oldInputValueOfValues [ i ] ) ) ) {
1138+ oldInputValueOfValues [ i ] = newInputValue && newInputValue . valueOf ( ) ;
11381139 }
11391140 }
11401141
0 commit comments