Bug Tracker

Modify

Ticket #3641 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

Merge function does not work correctly with 0/false values with same indexes.

Reported by: victorbartel Owned by: flesler
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: merge Cc: victorbartel
Blocking: Blocked by:

Description

Premature merge process finalization is occurred when 0/false values is situated in same positions in both arrays. For example $.merge([1,2,3],[4,5]) will work correctly and return [1,2,3,4,5] but $.merge([0,1,3],[0,2,4]) will return only [0,1,3]. This bug is caused by following comparison during while loop : while ( elem = second[ i++ ] ), when element is equal to 0/false and second[i++] has same value, interpreter will exit from loop. Solution modify loop properly.

Change History

comment:1 Changed 5 years ago by victorbartel

Sorry, It is more deep that I've described above. This problem is not related to the same position of element in both arrays. It occurs when one of elements from second array is equals to 0/false. while ( elem = 0 ), elem is false, loop is stopped. Same solution - modify loop properly.

comment:2 Changed 5 years ago by flesler

  • Cc victorbartel added
  • Owner set to flesler
  • Status changed from new to assigned

comment:3 Changed 5 years ago by flesler

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

Fixed at [5998].

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.