This is the "error", IE threat everything as my first example but you assign to a variable which is performed after the function expression. or you return the current function. Try this:
var slice = (function($slice){ setTimeout(function(){alert(slice)}); // guess which one will be in IE // and try to imagine the function had a timeout that would like to referer to itself .... try { //$slice.call(document.childNodes);// avoid it return function slice(list){ return $slice.call(list); }; } catch(e) {} return function slice(){ for(var r = [], i = 0, length = list.length; i < length; ++i) r[i] = list[i] ; return r; }; })(Array.prototype.slice); //alert(slice); Two things: my first example was just a forced one to demonstrate a "the facto behavior". The problem is about named functions and what we assume should be better than something else while in IE it does not really matter. Since every other browser ignore the rest, as long as IE9 will implement a reasonable engine, my silly forced example will always work as expected untill somebody will bring in the table a browser unable to understand/work as expected. In few words, last fallback for IE, whatever strategy we'll adopt, and imho, problem solved. But I am always ready to change my mind, just bring an example that will fail and I will :P On Tue, Sep 15, 2009 at 9:41 PM, Michael Geary <m...@mg.to> wrote: > > In both examples, we've added names to the various *slice* functions, but > the functions are still function expressions which are parsed the same in > all browsers. > > -Mike > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---