3

I recently upgraded a couple of sites to EE2.5.5. I was utilizing templates to store JQuery and its plugins, combining all within an index file of my 'scripts' group. This isn't necessarily best practice, or how I typically include JQuery in my more recent builds, but it worked for the sites for a very long time. Upon completing the EE2 upgrade, JQuery included in a template produces a script error, breaking the site's scripting.

Here is an example error from firebug using JQuery 1.7.1:

SyntaxError: unterminated string literal
...entElement;q.setAttribute("className","t"),q.innerHTML="<link/><table></table><

This occurs on all versions of JQuery I've tried, minified or not, and produces a variety of errors.

The real answer is "Don't load JQuery from a template", but I think the fact that EE is somehow breaking JS code when using a Javascript template type is something to note and question. Are there limitations to 'javascript' template types?

6
  • As your question is posted now, there is no question asked. Can you revise to ask a specific question when you have a sec? Take a look at the FAQ if you need guidance: expressionengine.stackexchange.com/faq#dontask
    – Anna_MediaGirl
    Jan 21, 2013 at 1:37
  • I'll guess the excellent answers to this previous question will get you going. Jan 21, 2013 at 4:35
  • out of curiosity is your template type set to javascript under template preferences?
    – mjr
    Jan 22, 2013 at 18:29
  • 1
    But the index template everything embedded in was not. Changing it to 'javascript' fixed the problem. I'm not sure if the template was changed back to 'web page' upon upgrade, or if it always was set that way and previous versions of EE didn't have a problem with it. Jan 25, 2013 at 0:59
  • 2
    If you solved your own issue, please write up and accept your own answer, so others know the solution. Jan 25, 2013 at 4:27

1 Answer 1

2

My specific issue was corrected by making sure that both the JavaScript files and the index file I was embedding them into were set to use the 'JavaScript' type.

Earlier versions of ExpressionEngine would work with that index file set to other template types, but the latest versions are particular, and submit more strict headers with the templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.