Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unfamiliar Javascript syntax/hack

I'm perusing some source, and I see this

<script type="text/javascript" src="script/jquery/jquery.1.7.1.js">//]]>
</script>
<script type="text/javascript" src="script/swfobject_modified.js">//]]>
</script>

There's a dozen or so dependencies in the head listed in such a fashion, what is the purpose of the //]]> after each script tag?

The code looks a bit old school, and is set to emulate IE7 in compat:

<meta http-equiv="X-UA-Compatible" content="IE=7" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Just curious really, thanks.

like image 701
danjah Avatar asked May 05 '15 11:05

danjah


1 Answers

My best guess is that the script code was originally put in a CDATA section like this:

<script type="text/javascript"
//<![CDATA[
//]]>
</script>

When deleting //<![CDATA[ (which wasn't needed since it's referring to an external source file), they simply neglected to remove the final //]].

like image 64
Rick Hitchcock Avatar answered Nov 13 '22 13:11

Rick Hitchcock