-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
问题是什么
不能处理循环引用
环境
- 浏览器:chrome 73.0.3683.75
在线例子
// case 1, 自身有环
const obj = {
foo: {
bar:null
}
}
obj.foo.bar = obj.foo
// case 2, 互相引用
const obj1 = {
foo: {
bar:null
}
}
const obj2 = {
baa: {
caa:obj1.foo
}
}
obj1.foo.bar = obj2.baa
extend(true, obj1,obj2);其他
我试了下 jquery 也不能处理这种, 看了下他源码, 处理的方式和你是一样的, 能解释下为什么要这么处理吗,如果真有循环引用的话, 会一直不能 return target ,那么这个判断条件就一直是 false 呀.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed