Bug Tracker

Opened 10 years ago

Closed 9 years ago

#6238 closed enhancement (wontfix)

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?

Change History (6)

comment:1 Changed 10 years ago by cowboy

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 ); });  

comment:2 Changed 10 years ago by andrew_

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

comment:3 Changed 9 years ago by dmethvin

Component: unfiledcore

comment:4 Changed 9 years ago by addyosmani

need: ReviewPatch
Priority: undecided

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

comment:5 Changed 9 years ago by snover

Milestone: 1.4.3
Priority: undecidedlow
Status: newopen
Type: bugenhancement
Version: 1.4.21.4.3

comment:6 Changed 9 years ago by john

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).

Note: See TracTickets for help on using tickets.