[jQuery] Re: IE will not eval this: eval(function(){alert('iesucks')})() Any ideas?
Thanks John - I was working on my frames plugin ( http://groups.google.com/group/jquery-en/browse_thread/thread/e1b2c367f354aead ) and needed to break closures when running a function in a different frame so I don't have much control over what I'm passed. The good news is that Matt Jake's suggestion worked and the plugin is finished. As it's based on code from your book I wouldn't mind getting your thoughts on it ;) On Apr 15, 12:06 pm, John Resig [EMAIL PROTECTED] wrote: I might be missing something, but this seems like a case where you would want to do this: (new Function(alert('iesucks')))() it's a little cleaner that way too. --John On 4/14/07, Diego A. [EMAIL PROTECTED] wrote: And for those who don't get what's going on... eval(function(){alert('iesucks')}) creates a function, but doesn't execute it. eval(function(){alert('iesucks')}()) creates the function and executes it immediately... On Apr 14, 6:49 pm, Matt Kruse [EMAIL PROTECTED] wrote: On Apr 14, 12:42 pm, Daemach [EMAIL PROTECTED] wrote: IE doesn't seem to like to eval anonymous functions. Is there a way around this other than to strip the function wrapper? eval(function(){alert('iesucks')})() Why not this instead? eval((function(){alert('iesucks')})()); Matt Kruse
[jQuery] Re: IE will not eval this: eval(function(){alert('iesucks')})() Any ideas?
I might be missing something, but this seems like a case where you would want to do this: (new Function(alert('iesucks')))() it's a little cleaner that way too. --John On 4/14/07, Diego A. [EMAIL PROTECTED] wrote: And for those who don't get what's going on... eval(function(){alert('iesucks')}) creates a function, but doesn't execute it. eval(function(){alert('iesucks')}()) creates the function and executes it immediately... On Apr 14, 6:49 pm, Matt Kruse [EMAIL PROTECTED] wrote: On Apr 14, 12:42 pm, Daemach [EMAIL PROTECTED] wrote: IE doesn't seem to like to eval anonymous functions. Is there a way around this other than to strip the function wrapper? eval(function(){alert('iesucks')})() Why not this instead? eval((function(){alert('iesucks')})()); Matt Kruse
[jQuery] Re: IE will not eval this: eval(function(){alert('iesucks')})() Any ideas?
javascript:eval((function(){alert('iesucks')})()) ??? On 4/14/07, Daemach [EMAIL PROTECTED] wrote: IE doesn't seem to like to eval anonymous functions. Is there a way around this other than to strip the function wrapper? I know you should normally avoid using eval for anything but I do have a good reason for doing this. -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: IE will not eval this: eval(function(){alert('iesucks')})() Any ideas?
Outstanding! Thank you very much... On Apr 14, 10:49 am, Matt Kruse [EMAIL PROTECTED] wrote: On Apr 14, 12:42 pm, Daemach [EMAIL PROTECTED] wrote: IE doesn't seem to like to eval anonymous functions. Is there a way around this other than to strip the function wrapper? eval(function(){alert('iesucks')})() Why not this instead? eval((function(){alert('iesucks')})()); Matt Kruse
[jQuery] Re: IE will not eval this: eval(function(){alert('iesucks')})() Any ideas?
And for those who don't get what's going on... eval(function(){alert('iesucks')}) creates a function, but doesn't execute it. eval(function(){alert('iesucks')}()) creates the function and executes it immediately... On Apr 14, 6:49 pm, Matt Kruse [EMAIL PROTECTED] wrote: On Apr 14, 12:42 pm, Daemach [EMAIL PROTECTED] wrote: IE doesn't seem to like to eval anonymous functions. Is there a way around this other than to strip the function wrapper? eval(function(){alert('iesucks')})() Why not this instead? eval((function(){alert('iesucks')})()); Matt Kruse