cd003e69 by Adam Heath

When a collection is fetched, forward any collectionEvents from it to

the change:$key handler on it's container.
1 parent 182cf47e
......@@ -37,7 +37,19 @@ define(function(require) {
} else {
return;
}
return obj.get(keypath);
var value = obj.get(keypath);
if (value instanceof Collection) {
var listener = function() {
var currentValue = obj.get(keypath);
if (value !== currentValue) {
obj.stopListening(value, collectionEvents, listener);
return;
}
obj.trigger('change:' + keypath, obj, currentValue);
};
obj.listenTo(value, collectionEvents, listener);
}
return value;
},
set: function set(obj, keypath, value) {
if (obj instanceof Model) {
......