Do not use HTML comments in script blocks
Description
Environment
None
Test Plan
None
Activity
Show:

Hui Tsao November 16, 2012 at 2:41 PM
Agree. I have merged to 2.9.x: r116508.
Neal Caidin November 16, 2012 at 7:45 AM
Since this change was made the QA team has done lots of testing in Samigo. We are not sure what we would expect to see, or what might break, but since nothing has been reported, perhaps we should just merge this one?
Thanks
Sam Ottenhoff September 27, 2012 at 12:22 PM
Samigo only.
Neal Caidin September 27, 2012 at 11:55 AM
On the whole Sakai system or specifically in an area like the CK Editor?
Sam Ottenhoff September 27, 2012 at 11:21 AM
Basic regression testing.
Fixed
Details
Details
Assignee
SAMIGO TEAM
SAMIGO TEAMReporter
Sam Ottenhoff
Sam OttenhoffComponents
Fix versions
Priority
Created July 24, 2012 at 4:14 PM
Updated April 17, 2018 at 8:08 AM
Resolved August 29, 2012 at 7:44 AM
http://www.javascripttoolbox.com/bestpractices/#script
In the ancient days of javascript (1995), some browsers like Netscape 1.0 didn't have any support or knowledge of the script tag. So when javascript was first released, a technique was needed to hide the code from older browsers so they wouldn't show it as text in the page. The 'hack' was to use HTML comments within the script block to hide the code.
Using HTML Comments In Script Is Bad
<script language="javascript">
<!--
// code here
//-->
</script>
No browsers in common use today are ignorant of the <script> tag, so hiding of javascript source is no longer necessary. In fact, it can be considered harmful for the following reasons:
Within XHTML documents, the source will actually be hidden from all browsers and rendered useless
– is not allowed within HTML comments, so any decrement operations in script are invalid