Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Javascript Comment Slashes

AndrewAndrew Member
in Bugs & Feature Requests edited January 2010
Hi guys

would just like to let you know i've found your cache template code for the cart page doing something fun.
when reading javascript files, it borks on the comments
for example, if this is on a new line
//hi i'm a comment
it's fine. but if it's after a line of code:
alert('for pony');//best alert evar
the // will be escaped to \/\/ and create an error. for now, i'm going to do the horrific and purge my js of comments, but I thought i'd let you know.

This only happens after "caching a url" for a cart template, and the comments changed to \/\/ are even found in the textarea where it says "cart template:"

also, just noticed, it changes links in the js file too:
$('.haha').onclick(function(){window.location = '';});
will become
$('.haha').onclick(function(){window.location = '\/\/\/encrypted';});

just letting you know. I've got a workaround already for my particular
  • lukeluke FoxyCart Team
    Thanks Andrew, we'll create a ticket and take a look.
  • brettbrett FoxyCart Team
    Check #5 here:

    Because of the differences between inline and external javascript, there are certain things that are just kind of impossible to account for. For example, you could have "http://"; in your js, and it wouldn't be a comment, so it'd need to be \/\/. The workaround is to add a space before the //, as that'll make it more clear that it's a comment. It's not perfect, but it works relatively well considering how crazy it is in the first place.

    As far as the https:\/\/ type stuff, that _should_ work, in most cases. Is it not for you?

    Does that make sense?
Sign In or Register to comment.