mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
fix emboxValue
This commit is contained in:
@@ -690,6 +690,18 @@ var codeGenInclusionArgs = function (tag) {
|
||||
return [];
|
||||
};
|
||||
|
||||
// Returns true if `a` and `b` are `===`, unless they are of a mutable type.
|
||||
// (Because then, they may be equal references to an object that was mutated,
|
||||
// and we'll never know. We save only a reference to the old object; we don't
|
||||
// do any deep-copying or diffing.)
|
||||
var safeEquals = function (a, b) {
|
||||
if (a !== b)
|
||||
return false;
|
||||
else
|
||||
return ((!a) || (typeof a === 'number') || (typeof a === 'boolean') ||
|
||||
(typeof a === 'string'));
|
||||
};
|
||||
|
||||
Spacebars.include = function (kindOrFunc, args) {
|
||||
args = args || {};
|
||||
if (typeof kindOrFunc === 'function') {
|
||||
@@ -740,7 +752,7 @@ Spacebars.include = function (kindOrFunc, args) {
|
||||
if (k === '__content' || k === '__elseContent')
|
||||
emboxedArgs[k] = args[k];
|
||||
else
|
||||
emboxedArgs[k] = UI.emboxValue(args[k]);
|
||||
emboxedArgs[k] = UI.emboxValue(args[k], safeEquals);
|
||||
}
|
||||
|
||||
return kind.extend(emboxedArgs);
|
||||
|
||||
@@ -110,9 +110,8 @@ UI.emboxValue = function (funcOrValue, equals) {
|
||||
var oldResult = curResult;
|
||||
curResult = func();
|
||||
if (! c.firstRun) {
|
||||
// XXX THE `===` CHECK BREAKS TEST-IN-BROWSER
|
||||
// if (! (equals ? equals(curResult, oldResult) :
|
||||
// curResult === oldResult))
|
||||
if (! (equals ? equals(curResult, oldResult) :
|
||||
curResult === oldResult))
|
||||
resultDep.changed();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user