From 5075c870fd831a1b4ef8f2c6ab0ca688ffd632dc Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Mon, 14 Jan 2019 16:29:14 +0100 Subject: [PATCH] docs(angular.copy): list object types / features that are not supported Closes #5085 Closes #13193 Closes #14352 Closes #15904 Closes #16055 Closes #16061 Closes #16067 --- src/Angular.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 1493cadff317..f9f21c37bd5b 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -783,7 +783,9 @@ function arrayRemove(array, value) { * @kind function * * @description - * Creates a deep copy of `source`, which should be an object or an array. + * Creates a deep copy of `source`, which should be an object or an array. This functions is used + * internally, mostly in the change-detection code. It is not intended as an all-purpose copy + * function, and has several limitations (see below). * * * If no destination is supplied, a copy of the object or array is created. * * If a destination is provided, all of its elements (for arrays) or properties (for objects) @@ -800,9 +802,22 @@ function arrayRemove(array, value) { * *
* `angular.copy` does not check if destination and source are of the same type. It's the - * developers responsibility to make sure they are compatible. + * developer's responsibility to make sure they are compatible. *
* + * @knownIssue + * This is a non-exhaustive list of object types / features that are not handled correctly by + * `angular.copy`. Note that since this functions is used by the change detection code, this + * means binding or watching objects of these types (or that include these types) might not work + * correctly. + * - [`ImageData`](https://developer.mozilla.org/docs/Web/API/File) + * - [`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) + * - [`ImageData`](https://developer.mozilla.org/docs/Web/API/ImageData) + * - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream) + * - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) + * - ['getter'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/ + * [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)` + * * @param {*} source The source that will be used to make a copy. Can be any type, including * primitives, `null`, and `undefined`. * @param {(Object|Array)=} destination Destination into which the source is copied. If provided,