-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Description
The defineReactive function uses getOwnPropertyDescriptor, which works only for properties declared on the object itself, but not on its ancestors:
/**
-
Define a reactive property on an Object.
*/
function defineReactive (obj, key, val, customSetter) {
var dep = new Dep()var property = Object.getOwnPropertyDescriptor(obj, key)
if (property && property.configurable === false) {
return
}
IMHO, this should be:
/**
-
Define a reactive property on an Object.
*/
function defineReactive(obj, key, val, customSetter) {// get property descriptor (own or inherited!)
var property = null;
for (var proto = obj; !property && proto != Object.prototype; proto = Object.getPrototypeOf(proto)){
property = Object.getOwnPropertyDescriptor(proto, key);
}
if (property && property.configurable === false) {
return;
}