This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
angular.copy loses own non-enumerable properties #15692
Milestone
Comments
zuzusik
added a commit
to zuzusik/angular.js
that referenced
this issue
Feb 8, 2017
copying object without own non-enumerable properties can lead to bugs when enumerable properties depend on non-enumerable fixes angular#15692
zuzusik
added a commit
to zuzusik/angular.js
that referenced
this issue
Feb 8, 2017
copying object without own non-enumerable properties can lead to bugs when enumerable properties depend on non-enumerable fixes angular#15692
This was referenced Feb 8, 2017
zuzusik
added a commit
to zuzusik/angular.js
that referenced
this issue
Feb 8, 2017
copying object without own non-enumerable properties can lead to bugs when enumerable properties depend on non-enumerable fixes angular#15692
zuzusik
added a commit
to zuzusik/angular.js
that referenced
this issue
Feb 9, 2017
copying object without own non-enumerable properties can lead to bugs when enumerable properties depend on non-enumerable fixes angular#15692
zuzusik
added a commit
to zuzusik/angular.js
that referenced
this issue
Feb 9, 2017
copying object without own non-enumerable properties can lead to bugs when enumerable properties depend on non-enumerable fixes angular#15692
zuzusik
added a commit
to zuzusik/angular.js
that referenced
this issue
Feb 9, 2017
copying object without own non-enumerable properties is non-consistent and can lead to bugs fixes angular#15692
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
angular.copy uses as destination object created from prototype, which it then populates with own object properties.
This way it loses own not enumerable properties which can cause bugs.
Demo : https://jsfiddle.net/zuzusik/7ye3m006/
What is the expected behavior?
Angular doesn't lose non-enumerable properties. I assume this can be achieved by iterating through
Object.getOwnPropertyNames
instead of usingfor (key in source)
loop and checking forhasOwnProperty
.What is the motivation / use case for changing the behavior?
This causes bug with JSData v3: https://jsfiddle.net/zuzusik/6evanz3g/
Details: js-data/js-data#442
Which versions of AngularJS
Angular 1.6.2, any browser.
The text was updated successfully, but these errors were encountered: