Reputation: 864
I updated to the latest coffee script and still am getting the following error: Any ideas on what might be causing the error?
ie = (->
undef = undefined
v = 3
div = document.createElement("div")
all = div.getElementsByTagName("i")
while div.innerHTML = "<!--[if gt IE " + (++v) +"]><i></i><![endif]-->"
all[0]
(if v > 4 then v else undef)
())
I've removed this line from a massive js file I'm converting to coffee script and it all compiles fine. Can anyone see what might be wrong with this?
SyntaxError: unexpected INDENT
>> On line: 816
>> while div.innerHTML = "<!--[if gt IE " + (++v) +"]><i></i><![endif]-->"
>> ^
Upvotes: 1
Views: 65
Reputation: 5515
Assuming you got your JS to do this from here, then you have translated the JavaScript to CoffeeScript poorly.
What you want is something like this:
ie = do ->
version = 3
div = document.createElement 'div'
all = div.getElementsByTagName 'i'
testVersion = ->
div.innerHTML = "<!--[if gt IE #{version}]><i></i><![endif]-->"
all[0]
while testVersion()
version += 1
if version > 4 then version else no
Upvotes: 3