修改get.copy

This commit is contained in:
kuangthree 2024-01-07 14:51:07 +08:00
parent 05d148d10e
commit e66d6778e0
1 changed files with 2 additions and 8 deletions

View File

@ -824,14 +824,8 @@ export class Get extends Uninstantable {
const constructor = obj.constructor;
let target;
if (!canTranverse[getType(obj)]) {
try {
// @ts-ignore
target = new constructor(obj);
} catch (error) {
if (obj instanceof HTMLElement) {
target = obj.cloneNode(true); // 不能cloneNode就寄吧累了
} else throw error
}
target = obj;
return target;
}
// @ts-ignore
else target = constructor ? new constructor() : Object.create(null);