Skip to content

Commit d561486

Browse files
authored
Revert "Preserve object prototypes when cloning (#7381)" (#7727)
This reverts commit 51be344.
1 parent 35d669e commit d561486

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

src/helpers/helpers.core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export function clone(source) {
157157
}
158158

159159
if (isObject(source)) {
160-
const target = Object.create(source);
160+
const target = {};
161161
const keys = Object.keys(source);
162162
const klen = keys.length;
163163
let k = 0;

test/specs/helpers.core.tests.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -316,27 +316,6 @@ describe('Chart.helpers.core', function() {
316316
expect(output.o).not.toBe(o0);
317317
expect(output.o.a).not.toBe(a1);
318318
});
319-
it('should preserve prototype of objects', function() {
320-
// https://github.com/chartjs/Chart.js/issues/7340
321-
class MyConfigObject {
322-
constructor(s) {
323-
this._s = s;
324-
}
325-
func() {
326-
return 10;
327-
}
328-
}
329-
var original = new MyConfigObject('something');
330-
var output = helpers.merge({}, {
331-
plugins: [{
332-
test: original
333-
}]
334-
});
335-
var clone = output.plugins[0].test;
336-
expect(clone).toBeInstanceOf(MyConfigObject);
337-
expect(clone).toEqual(original);
338-
expect(clone === original).toBeFalse();
339-
});
340319
});
341320

342321
describe('mergeIf', function() {

0 commit comments

Comments
 (0)