Celeritas
Celeritas

Reputation: 15053

removing commented out code from webpage

I am cleaning up a .cfm file and removing commented out code. I'm not sure what can be safely removed, because doesn't so scripting languages use commented out code like SSI?

For example

<!--[if lt IE 8]>
    <style type="text/css" media="all">
        @import "../styles/ie.css";
    </style>
    <script type="text/javascript" src="../scripts/jquery.bgiframe.min.js"></script>
<![endif]-->

I think is important but do I need to keep anything between <!-- and --> in this:

<!-- /#toolbar -->

    <div id="content">

    <div id="sidebar-left" class="sidebar">
        <div class="top"></div>
        <div id="sidebar-left-inner">
            <p id="date"></p>
            <cfinclude template="requires/nowProcessing.cfm">
            <!-- /.now-serving -->

            <div id="sub-nav">
            <!-- InstanceBeginEditable name="leftMenuInclude" -->

Not sure if relevant but the file contains JavaScript and CSS and possibly other languages.

EDIT:Out of curiousity what language are these from?

<!-- InstanceBeginEditable name="leftMenuInclude" -->
<!-- /#main -->
<!-- /#content -->

Upvotes: 1

Views: 396

Answers (2)

c0deNinja
c0deNinja

Reputation: 3986

Since you aren't using a script this is easy... Simply remove commented out code only!

This does not mean that you should remove everything between:

<!-- -->

Some will be comments, for example:

<!-- this is a comment to explain something -->

And some will be conditional comments, for example:

<!--[if lt IE 8]> <![endif]-->

Use your knowledge of the code to remove the appropriate commented out code... aka, code that has no purpose!

Make sure you understand the difference between comments and commented out code!

Upvotes: 1

Adam
Adam

Reputation: 3665

That is a conditional comment. It will target less than IE8 because of this line. So its there for a purpose.

<!--[if lt IE 8]>

http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx

Upvotes: 0

Related Questions