Bug Tracker

Opened 10 years ago

Closed 10 years ago

#5306 closed bug (fixed)

$.isObject() is incorrect, and in some cases will cause $.extend() malfunctions

Reported by: Tony Chen Owned by:
Priority: major Milestone: 1.4
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:

Description

code:

x = { a:{ a1:1, a2:2 }, b:2 };
y = { a:{ a3:3 }, c:3 };
console.log("x is ",JSON.stringify(x));
console.log("y is ",JSON.stringify(y));
console.log("$.isObject(x) is ",$.isObject(x))
z = $.extend(true,{}, x, y);
console.log("execut: z = $.extend(true,{}, x, y);");
console.log("x is ",JSON.stringify(x)," <--should not be changed!");

output:

x is  {"a":{"a1":1,"a2":2},"b":2}
y is {"a":{"a3":3},"c":3}
$.isObject(x) is false
execut: z = $.extend(true,{}, x, y);
x is {"a":{"a1":1,"a2":2,"a3":3},"b":2} <-- should not be changed!

Change History (2)

comment:1 Changed 10 years ago by Tony Chen

From revision 6442 up to 6586

comment:2 Changed 10 years ago by john

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.