Bug Tracker

Modify

Ticket #5306 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

$.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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by Tony Chen

From revision 6442 up to 6586

comment:2 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to fixed

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.