coffeekup
coffeekup copied to clipboard
element id shorthand doesn't work client side on IE7
the coffekup code: div "#my_id", -> gives: <DIV class="#my_id"> instead of giving the element an id it gives the element a class that starts with a '#'. However, it works if you do this instead: div id: "register_interest", ->
giving elements classes ( div ".my_id", -> ) works as expected though.
NOTE. This only occurs when client side rendering a template in Internet explorer 7. Might apply to other versions of IE as well.
Edit: version 0.3.1 of coffeekup and 1.1.2 of coffeescript used
Seems like it's the same with current versions of Opera.
I have the same issue with IE8
fix here:
@@ -126,10 +126,12 @@ skeleton = (data = {}) ->
classes = []
for i in str.split '.'
- if '#' in i
- id = i.replace '#', ''
+ if i.length == 0
+ continue
+ if "#" == i[0]
+ id = i.slice 1
else
- classes.push i unless i is ''
+ classes.push i
text " id=\"#{id}\"" if id
I restricted it to hash in the beginning only. Moved empty string check up.