Use CDATA inside script blocks

Using < or > signs inside <script> tags is problematic, even if it is enclosed in double quotes. For example:

<script> body.innerHTML = "<a href='test.html'>Test</a>"; </script>

will fail because the < sign is invalid inside a script tag when it is parsed. So, use CDATA sections for such script blocks. For example:

<script><![CDATA[ body.innerHTML = "<a href='test.html'>Test</a>"; ]]></script>

If you see that your script blocks are not getting processed at all and the functions you are trying to access are completely unavailable, then this might be the reason.

This can also be a problem with for loops. If the script is not enclosed in CDATA, then the following example will fail:

for(var i = 0;i<10;i++)

We need some space before and after the "less than" (<) sign. Otherwise when we parse the flake file, "<10;" appears as a tag in the flake HTML file. Putting a space after the "<" characters prevents it from becoming a tag.

for(var i = 0; i < 10; i ++)

However, the preferred mechanism is to include the script in a CDATA element, and the whitespace is no longer an issue.