I have quite a simple page where I include a .js JavaScript. My include code is very straightforward:
code:
<script type="text/javascript" src="scripts.js"></script>
The above code is what I would expect to show up when viewing the source code of the final HTML page in the browser.
And it does. Once.
If I reload the page or click on a link and come back to the page, it’s changed to (completely correct, with CDATA entries and all) inline JavaScript in the source code instead, like so:
code:
<script type="text/javascript">//<![CDATA[
function yadaYada {
[stuff here]
}
//]]></script>
Not that this is really a big deal, but does anyone have any logical explanation for why this is happening? I’ve Googled it and can’t find any documentation of this behaviour anywhere. It kind of bugs me a bit, ’cause I think inline JavaScript in HTML files looks ugly. I don’t even know if this is taking place on the server or in the browser.
Edit: Also possibly related: all my carefully balanced tabs and indents in the source code are gone, too.