0.9.2

Back | Changelog
2011-08-03

New quick fix for Sugar. In versions This works fine, however:

var one = function(){}; var two = function(){}; [one,two].indexOf(one);

In this example the intended behavior is clearly to find the index of the function reference "one". However, Sugar would attempt to run that actual function against elements in the array as an equality check (a la filter), when it should have been doing a strict equals directly on the function itself.

This was pointed out to me by a user a few days ago who had attempted to use indexOf against an array of event handlers. At that point it had already been fixed in another branch as part of a major update (intended as v0.9.2) to bring Sugar closer to the ES5 spec. However that update isn't quite ready yet. When another user complained last night about jQuery templates breaking, I realized immediately that this must be the problem, and that the use of indexOf with functions is more common than I thought.

Anyway, this fix should hold people over until the next release (should be v0.9.3) which should be out sometime this week.