You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
- for ( var key in source) {
- destination[key] = copy(source[key]);
- }
+ for ( var key in source) {
+ if (source.hasOwnProperty(key)) {
+ destination[key] = copy(source[key]);
+ }
+ }
Can't think of any reason people would want the prototype chain treated as data...
We hit this issue in a couple of places, one we have "extended" ngResource objects with model-methods on them, and those get copied on $save. Not a problem until something references the DOM and it tries to copy the entire document.
Also when we open an edit dialog, we snapshot the current state of the data so that cancel would revert it. We do that using angular.copy and likewise, all the prototype methods get copied which breaks if the DOM is referenced somehow, with a stack overflow.