So im working on this TinyMCE javascript, it should be pretty straight forward, but here’s the deal. When I look at my page source this is what I see
<script type="text/javascript">
<!--
tinyMCE.init({
mode : "exact",
elements : "content",
theme : "advanced",
skin : "o2k7",
skin_variant : "blue",
plugins : "advimage,advlink,contextmenu,fullscreen,inlinepopups,nonbreaking,paste,preview,print,safari,style,table",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,|,hr,removeformat,visualaid",
theme_advanced_buttons3 : "tablecontrols,|,preview,print,fullscreen,code",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
fullscreen_new_window : true
});
// -->
</script>
Can someone please explain to me why my browser (FF and IE) puts the comment around my script? Script seems to work correctly though…
The HTML comments are there to prevent older browsers showing the JavaScript as text. Old browsers will treat your JS code as one long HTML comment. On the other hand, new JavaScript-aware browsers will normally interpret JS code between the tags and (the first and last lines of your JS code will be treated by the JavaScript interpreter as one-line comments).