Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

IE10+, Firefox: "Invalid calling object" on properties after angular.copy of a File object #8312

Closed
nlwillia opened this issue Jul 23, 2014 · 4 comments

Comments

@nlwillia
Copy link

Given a file object, calling angular.copy and trying to access properties like "name" and "size" on the copy will result in a "Invalid calling object" error being thrown in IE 10+. In Firefox, the error is "Illegal operation on WrappedNative prototype object". Tested in angular 1.3 beta 15. (Demo) The problem does not occur in angular 1.1.5 or in Chrome.

@nlwillia nlwillia changed the title IE10+: "Invalid calling object" on properties after angular.copy of a File object IE10+, Firefox: "Invalid calling object" on properties after angular.copy of a File object Jul 23, 2014
@btford
Copy link
Contributor

btford commented Jul 24, 2014

My recommendation would be to write your own util for copying specific options.

angular.copy's implementation is tailored to Angular's internal needs and implemented with certain performance characteristics in mind. For many cases, this utility works well in application logic, but when you need to retain certain special object characteristics (like some proto chain or non-enumerable property), you should write or use another utility.

@btford btford added this to the Backlog milestone Jul 24, 2014
@nlwillia
Copy link
Author

Sure. It might be worth giving a nod to this in the docs.

@btford
Copy link
Contributor

btford commented Jul 25, 2014

Agreed. We get many issues regarding this. /cc @IgorMinar

@gkalpak
Copy link
Member

gkalpak commented Apr 7, 2016

Let's track the issue in #14352.

@gkalpak gkalpak closed this as completed Apr 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants