Closed
Description
I get an error immediately when I go to http://jashkenas.github.com/coffee-script/ in Internet Explorer 8.
The text of the error is:
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
Timestamp: Sun, 9 May 2010 06:29:18 UTC
Message: 'prototype' is null or not an object
Line: 1
Char: 251857
Code: 0
URI: http://jashkenas.github.com/coffee-script/extras/coffee-script.js
Activity
ben-x9 commentedon May 10, 2010
I just ran into this issue myself running the script locally.
I attempted to rollback to 0.5.6 just in case this bug was something recently introduced, but got a different error:
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; FDM; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Mon, 10 May 2010 13:48:20 UTC
Message: 'undefined' is null or not an object
Line: 1
Char: 21693
Code: 0
URI: lib/coffee-script-0.5.6.js
jashkenas commentedon May 15, 2010
Sorry about the IE broken-ness.
extras/coffee-script.js
is now fixed on master, and should work live on the Internet Explorer of your choosing.The two issues which had to be solved were these:
Array#indexOf
, naturally. I added one toHelpers
.Closing the ticket.
d2kagw commentedon Jun 28, 2010
That's a massive shame.
I was using the named functions when looping through classes to detect the type of the class.
For example:
class Person
getName: ->
@name
Would have output "Neo", but now it's just "" (empty string).
Any ideas of other ways of getting the class name?
jashkenas commentedon Jun 28, 2010
The function isn't named anymore (because of the IE bug), so no -- there isn't a way to get its name, apart from tagging it manually with a property. A real shame, I completely agree.
satyr commentedon Sep 7, 2010
Why not keep them named, but with some prefix and/or suffix to avoid name collisions. e.g.:
fn = ->
into
var fn;
fn = function __fn() {}
devinrhode2 commentedon Dec 19, 2012
@jashkenas are there ANY scenarios where we can put in function names? I've been working on TraceKit.js and was oblivious to this IE error, me and @occ will probably re-write TraceKit in coffeescript.
@satyr mentioned giving them a prefix, which is way better for a stack trace than a helpless
(anonymous function)
We could even add a few random numbers to the end of the function name, a very simple and easy to implement solution, that would also be very robust. Soon thereafter, we could focus on prefixing by the class name and more deterministic identifiers.
I could totally work on this, very carefully of course.
experimental commit: derive names for function expressions when we can
toomim commentedon Jun 26, 2015
This feature indeed is useful for debugging. What about enabling it as an option that people can enable in development, when testing on chrome/firefox/safari? They could then disable it in production.
I'd also be able to use this option for most of my coffeescript projects because they compile in the browser. So I can detect at run-time if the browser is not IE, and if so, enable the anonymous named functions.