garann means > totes profesh

a defunct web development blog

parentheses in jquery-tmpl

Wed, 11 Aug 2010 23:28:11 +0000

Apparently jquery-tmpl doesn't like parentheses in IE.

Damn near went back to jTemplates for my work project yesterday, because jquery-tmpl was shitting the bed in IE and no one could figure out specifically why. We were going to write it off as not done enough to use, but after looking at the code I'd have to change because jTemplates requires a container to load into where jquery-tmpl can use appendTo(), I decided it was worth doing some process of elimination first. The issue turned out to be parentheses I was using in conditionals, i.e.:

{{if (user == loggedInUser)}}

Removing the parentheses allowed the scripts to run normally in IE and didn't cause any other problems. However, I worry what could happen if the parentheses weren't just a syntactic preference, but were actually necessary. What if I were, like, doing math?

I didn't find anything when I googled the issue, so I thought I'd note this caveat here. I'm sure it's temporary, but if you're also using those templates.. now you know!