Skip to main content

Bug Tracker

Side navigation

#6238 closed enhancement (wontfix)

Opened March 07, 2010 05:20PM UTC

Closed April 16, 2011 09:12PM UTC

All "each" style callbacks should pass consistent arguments.

Reported by: cowboy Owned by:
Priority: low Milestone: 1.next
Component: effects Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

logs what you'd expect.

$('*').each(function( i, elem ){ console.log( i, elem ); });

hey, it's an undefined party and everyone's invited!

$('*').fadeOut(function( i, elem ){ console.log( i, elem ); });

This metaphor is used in many, many places, and it should be consistent across jQuery.

In addition, I'd like to see a third argument passed, which is a reference to the initial collection being operated on - is that even possible?

Attachments (0)
Change History (6)

Changed March 07, 2010 05:22PM UTC by cowboy comment:1

I meant:

// logs what you'd expect.  
$('*').each(function( i, elem ){ console.log( i, elem ); });  
// hey, it's an undefined party and everyone's invited!  
$('*').fadeOut(function( i, elem ){ console.log( i, elem ); });  

Changed March 07, 2010 05:29PM UTC by andrew_ comment:2

+1 for Ben's suggestion of passing the initial collection.

Changed June 12, 2010 03:26AM UTC by dmethvin comment:3

component: unfiledcore

Changed October 08, 2010 11:06PM UTC by addyosmani comment:4

need: ReviewPatch
priority: → undecided

I agree that this behavior should be consistent. Moving to patch.

Changed October 15, 2010 10:15PM UTC by snover comment:5

milestone: 1.4.3
priority: undecidedlow
status: newopen
type: bugenhancement
version: 1.4.21.4.3

Changed April 16, 2011 09:12PM UTC by john comment:6

component: coreeffects
milestone: → 1.next
resolution: → wontfix
status: openclosed

I'm not completely convinced that it makes sense in this case - as it's not a synchronous loop - it's more akin to attaching an event that is fired when fadeOut is complete (and I don't think that events really make sense having this sort of thing).