Skip to main content

Bug Tracker

Side navigation

#11776 closed bug (worksforme)

Opened May 16, 2012 02:50AM UTC

Closed May 16, 2012 07:06PM UTC

Last modified August 16, 2012 01:58PM UTC

$.map is to eager on testing null

Reported by: mikael@karon.se Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
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

Attachments (0)
Change History (3)

Changed May 16, 2012 02:53AM UTC by dmethvin comment:1

keywords: → needsdocs

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.

Changed May 16, 2012 07:06PM UTC by dmethvin comment:2

resolution: → worksforme
status: newclosed

Docs updated.

Changed August 16, 2012 01:58PM UTC by dmethvin comment:3

keywords: needsdocs