@@ -1083,28 +1083,28 @@ function $ParseProvider() {
1083
1083
return list ;
1084
1084
}
1085
1085
1086
- function simpleEquals ( o1 , o2 ) {
1087
- if ( o1 == null || o2 == null ) return o1 === o2 ; // null/undefined
1086
+ function expressionInputDirtyCheck ( newValue , oldValue ) {
1087
+ if ( newValue == null || oldValue == null ) return newValue === oldValue ; // null/undefined
1088
1088
1089
- if ( typeof o1 === " object" ) {
1089
+ if ( typeof newValue === ' object' ) {
1090
1090
1091
1091
// attempt to convert the value to a primitive type
1092
1092
// TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can
1093
1093
// be cheaply dirty-checked
1094
- o1 = o1 . valueOf ( ) ;
1094
+ newValue = newValue . valueOf ( ) ;
1095
1095
1096
- if ( typeof o1 === " object" ) {
1096
+ if ( typeof newValue === ' object' ) {
1097
1097
// objects/arrays are not supported - deep-watching them would be too expensive
1098
1098
return false ;
1099
1099
}
1100
1100
1101
- o2 = o2 . valueOf ( ) ;
1101
+ oldValue = oldValue . valueOf ( ) ;
1102
1102
1103
1103
// fall-through to the primitive equality check
1104
1104
}
1105
1105
1106
1106
//Primitive or NaN
1107
- return o1 === o2 || ( o1 !== o1 && o2 !== o2 ) ;
1107
+ return newValue === oldValue || ( newValue !== newValue && oldValue !== oldValue ) ;
1108
1108
}
1109
1109
1110
1110
function inputsWatchDelegate ( scope , listener , objectEquality , parsedExpression ) {
@@ -1114,11 +1114,11 @@ function $ParseProvider() {
1114
1114
var lastResult ;
1115
1115
1116
1116
if ( inputExpressions . length === 1 ) {
1117
- var oldInputValue = simpleEquals ; // init to something unique so that equals check fails
1117
+ var oldInputValue = expressionInputDirtyCheck ; // init to something unique so that equals check fails
1118
1118
inputExpressions = inputExpressions [ 0 ] ;
1119
1119
return scope . $watch ( function expressionInputWatch ( scope ) {
1120
1120
var newInputValue = inputExpressions ( scope ) ;
1121
- if ( ! simpleEquals ( newInputValue , oldInputValue ) ) {
1121
+ if ( ! expressionInputDirtyCheck ( newInputValue , oldInputValue ) ) {
1122
1122
lastResult = parsedExpression ( scope ) ;
1123
1123
oldInputValue = newInputValue ;
1124
1124
}
@@ -1128,15 +1128,15 @@ function $ParseProvider() {
1128
1128
1129
1129
var oldInputValues = [ ] ;
1130
1130
for ( var i = 0 , ii = inputExpressions . length ; i < ii ; i ++ ) {
1131
- oldInputValues [ i ] = simpleEquals ; // init to something unique so that equals check fails
1131
+ oldInputValues [ i ] = expressionInputDirtyCheck ; // init to something unique so that equals check fails
1132
1132
}
1133
1133
1134
1134
return scope . $watch ( function expressionInputsWatch ( scope ) {
1135
1135
var changed = false ;
1136
1136
1137
1137
for ( var i = 0 , ii = inputExpressions . length ; i < ii ; i ++ ) {
1138
1138
var newInputValue = inputExpressions [ i ] ( scope ) ;
1139
- if ( changed || ( changed = ! simpleEquals ( newInputValue , oldInputValues [ i ] ) ) ) {
1139
+ if ( changed || ( changed = ! expressionInputDirtyCheck ( newInputValue , oldInputValues [ i ] ) ) ) {
1140
1140
oldInputValues [ i ] = newInputValue ;
1141
1141
}
1142
1142
}
0 commit comments