On 12/27/06, Michael Geary <[EMAIL PROTECTED]> wrote:
> Not only not related to jQuery, but not related to closures either. :-)
>
> The problem is that setTimeout doesn't accept the additional arguments you
> are passing it.
>
> Is there any reason you can't do this:
>
> setTimeout( function() { doStuff( "stuff", 1, 2 ); }, 100 );
>
> That would work in any browser.I was intrigued by the syntax used by Moe, as I had never seen it. It's documented at <http://developer.mozilla.org/en/docs/DOM:window.setTimeout>, stating: "Note that passing additional parameters to the function in the first syntax does not work in Internet Explorer." Anyway, as I see possible uses for it, I've coded a helper: function setTimeoutH(f, t) { var params = [].slice.call(arguments, 2); var f2 = function() { f.apply(null, params); } return window.setTimeout(f2, t); } Hope it helps someone. > > i hope someone on this list can help me here, even tho > > my question is not directly related to jquery (duck). > > > > i have trouble getting my closures to work in ie: > > > > > > --snip > > > > // > > // A) this doesn't work in ie (ff & opera grok it) > > // > > setTimeout( function( a,b,c ) { doStuff( a,b,c ) }, 100, > > "stuff", 1, 2 ); > > > > > > // > > // B) this works in IE > > // > > var fref = iehelper( "stuff", 1, 2 ); > > setTimeout( fref, 100 ); > > > > function iehelper( a,b,c ) { > > return ( function() { > > doStuff( a,b,c ); > > }); > > } > > > > --snap > > > > > > anyone know how to feed that to ie without > > the nasty helper function? -- Choan <http://choangalvez.nom.es/> _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
