Bug Tracker

Modify

Ticket #11776 (closed bug: worksforme)

Opened 13 months ago

Last modified 10 months ago

$.map is to eager on testing null

Reported by: mikael@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

Given

console.log($.map([ 1, undefined, , 2, null, 3 ], function (e, i) { return e; }));

results in

[ 1, 2, 3 ]

where I'd expect

[ 1, undefined, undefined, 2, 3 ]

Underlying problem is that we compare using value != null instead of value !== null

Change History

comment:1 Changed 13 months ago by dmethvin

  • Keywords needsdocs added

I am sure there is code depending on undefined to remove the element by now, so I don't think we want to change the behavior. Instead I think we should document the current behavior.

comment:2 Changed 13 months ago by dmethvin

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

Docs updated.

comment:3 Changed 10 months ago by dmethvin

  • Keywords needsdocs removed

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.