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

angular.merge should copy Blob like Object.assign #15992

Closed
1 of 3 tasks
krulik opened this issue May 16, 2017 · 2 comments · Fixed by #16036
Closed
1 of 3 tasks

angular.merge should copy Blob like Object.assign #15992

krulik opened this issue May 16, 2017 · 2 comments · Fixed by #16036

Comments

@krulik
Copy link

krulik commented May 16, 2017

I'm submitting a ...

  • bug report
  • feature request
  • other (Please do not submit support requests here (see above))

Current behavior:

angular.merge doesn't copy Blob objects from source to destination.
The property is copied but the value is no longer a Blob object but an empty Object.

Expected / new behavior:

The expected behaviour would be to copy the Blob as is from source to destination.
Object.assign behaves this way (doesn't have this bug).

Minimal reproduction of the problem with instructions:

var aFileParts = ['<a id="a"><b id="b">hey!</b></a>']; // an array consisting of a single DOMString
var oMyBlob = new Blob(aFileParts, {type : 'text/html'}); // the blob
var obj1 = {blob: oMyBlob, foo: 1};
var obj2 = angular.merge({}, obj1, {foo: 2});
var obj3 = Object.assign({}, obj1, {foo: 2});
console.assert(obj2.blob instanceof Blob === obj3.blob instanceof Blob, 'angular.merge should copy Blobs like Object.assign');

Angular version: 1.6.1

Browser: [Chrome 57 Mac OS X El Capitan ]

Anything else:

@pedrolucasp
Copy link

@Narretz Can I create a PR to fix this?

@Narretz
Copy link
Contributor

Narretz commented May 22, 2017

I would like to talk abiut this with the team as I think we should deprecate angular.merge, as it is not used inside core. Devs should use Object assign or lodash instead

Narretz added a commit to Narretz/angular.js that referenced this issue Jun 6, 2017
This function has problems with special object types but since it's not used in core,
it is not worth implementing fixes for these cases.
A general purpose library like lodash (provides `merge`) should be used instead.

Closes angular#12653
Closes angular#14941
Closes angular#15180
Closes angular#15992
Narretz added a commit to Narretz/angular.js that referenced this issue Jun 6, 2017
This function has problems with special object types but since it's not used in core,
it is not worth implementing fixes for these cases.
A general purpose library like lodash (provides `merge`) should be used instead.

Closes angular#12653
Closes angular#14941
Closes angular#15180
Closes angular#15992
Narretz added a commit that referenced this issue Jun 12, 2017
This function has problems with special object types but since it's not used in core,
it is not worth implementing fixes for these cases.
A general purpose library like lodash (provides `merge`) should be used instead.

Closes #12653
Closes #14941
Closes #15180
Closes #15992
Closes #16036
Narretz added a commit that referenced this issue Jun 29, 2017
This function has problems with special object types but since it's not used in core,
it is not worth implementing fixes for these cases.
A general purpose library like lodash (provides `merge`) should be used instead.

Closes #12653
Closes #14941
Closes #15180
Closes #15992
Closes #16036
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants