coffeekup icon indicating copy to clipboard operation
coffeekup copied to clipboard

element id shorthand doesn't work client side on IE7

Open hankmander opened this issue 13 years ago • 3 comments

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

hankmander avatar Nov 09 '11 15:11 hankmander

Seems like it's the same with current versions of Opera.

hankmander avatar Dec 20 '11 16:12 hankmander

I have the same issue with IE8

treeform avatar Jan 21 '12 00:01 treeform

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.

treeform avatar Jan 23 '12 19:01 treeform