Closed timeless1406 closed 3 years ago
This is a repo for the https://code.jquery.com/ website, not for jQuery itself. I see you already created https://github.com/jquery/jquery/issues/4860 so I'm just going to close this one.
OK, Thanks for you reply!
Test Code:
var obj = { a: 1, b: undefined, c: null, d: true, e: new Date('2019-12-24'), f: new RegExp('\\w+'), g: NaN, h: Symbol("foo"), i: { total:12, list:[{name:'小明',age:34},{name:'小红',age:23}] }, j: function(param) { console.log(param); } }; obj.k = obj; var result = {}; $.extend(true, result, obj);
jquery: v3.6.0My thinking: jQuery only considers ‘option[key]’ reference to target, and does not consider the reference to the ‘option’; My solution: Add conditional judgment:copy === options
if ( name === "__proto__" || target === copy || copy === options) { continue; }
Then running is OK.