diff --git a/Foundation/CPKeyValueObserving.j b/Foundation/CPKeyValueObserving.j index 745e884be..005603b3b 100644 --- a/Foundation/CPKeyValueObserving.j +++ b/Foundation/CPKeyValueObserving.j @@ -254,8 +254,11 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld, kvoClass._replacedKeys = _replacedKeys; //copy in the methods from our model subclass - var methodList = _CPKVOModelSubclass.method_list, - count = methodList.length, + var methodList = _CPKVOModelSubclass.method_list; + if ([_targetObject isKindOfClass:[CPDictionary class]]) + methodList = methodList.concat(_CPKVOModelDictionarySubclass.method_list); + + var count = methodList.length, i = 0; for (; i < count; i++) @@ -264,19 +267,6 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld, class_addMethod(kvoClass, method_getName(method), method_getImplementation(method), ""); } - if ([_targetObject isKindOfClass:[CPDictionary class]]) - { - var methodList = _CPKVOModelDictionarySubclass.method_list, - count = methodList.length, - i = 0; - - for (; i < count; i++) - { - var method = methodList[i]; - class_addMethod(kvoClass, method_getName(method), method_getImplementation(method), ""); - } - } - _targetObject.isa = kvoClass; }