There definitely is a reason for it. jQuery is a library for working with the DOM, it is not a library meant to fix every problem with JavaScript or to try to extend JavaScript in every possible way. When using jQuery specifically to work with the DOM (probably >90% of what you're using it for, and 100% of what the average user uses it for), it makes perfect sense to set the context to the current item. Also, native event handlers set the context to the event target, so jQuery had an existing model to follow.
On Aug 11, 6:09 am, Pauan <pcxunlimi...@gmail.com> wrote: > I think you guys are missing the point. This isn't a question about > object-oriented programming (in JavaScript or otherwise). It's about > jQuery's handling of "this" within the context of "each". > > To answer the original question, I don't think there's any real reason > for it. It was an unfortunate blunder (probably intended for > convenience) that will probably remain (for backwards compatibility). > As said, you can store the reference to "this" in a variable, so you > can work around it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---