Being able to use addons/update.js with a prototype seems to be a goal of the addon according to this line:
|
return copyProperties(new x.constructor(), x); |
Since we use object constructor instead of just {}
When updating an object with a prototype, the prototype is kept, as expected, but the copyProperties.js include prototype methods as object properties.
This is probably because of this loop:
See this http://jsfiddle.net/QVjLw/
I think the loop should be
for (var k in v) {
if ( v.hasOwnProperty(k) ) {
obj[k] = v[k];
}
}
Instead of
for (var k in v) {
obj[k] = v[k];
}
It would be nice to not pollute the object attributes with unnecessary methods and keep them in the prototype
Being able to use
addons/update.jswith a prototype seems to be a goal of the addon according to this line:react/src/addons/update.js
Line 29 in 3eb3641
Since we use object constructor instead of just {}
When updating an object with a prototype, the prototype is kept, as expected, but the copyProperties.js include prototype methods as object properties.
This is probably because of this loop:
react/src/vendor/core/copyProperties.js
Line 39 in 8a47813
See this http://jsfiddle.net/QVjLw/
I think the loop should be
Instead of
It would be nice to not pollute the object attributes with unnecessary methods and keep them in the prototype