Wednesday, 30 November 2016

Comments and the JS engine

Netsurf's javascript engine seems to choke on this:

<script type="text/javascript">
<!--
code goes here
//-->
</script>


I'm pretty sure that <!-- is meant to be treated as meaning the same thing as // in the sense that it represents the start of a single line comment.


Either the javascript engine is choking on <!-- because it doesn't understand it, or it is treating it the same as a html comment, which is even worse.


More info here:

http://www.javascripter.net/faq/comments.htm

www.javascripter.net
Question: How do I insert comments in JavaScript code? Answer: JavaScript supports three different types of comments: Multiple-line C-style comments.

No comments:

Post a Comment