what does this comment /*@cc_on!@*/0 do inside an if statement in javascript?

just a little question about this comment I found on an ebook about HTML5: /*@cc_on!@*/0 this comment should be somehow bound to the recognition of the IE browser in order to use the document.createElement() to create the unrecognized HTML5 elements, but I didn't find useful infos about the meaning of how this works cause even the author doesn't explain it. Could someone explain me what it is and what it does, please?

Thanks for the attention!

EDIT:

in the ebook the author says:

The next example demonstrates how to solve the problem for all the new elements introduced in HTML5. Here we include all the elements we’d like to force IE to recognize:

And here is the code:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <title>Styling Unknown Elements - 3</title>
    <script>
        (function() {
            if (! /*@cc_on!@*/ 0)
                return;

            var e = "abbr,article,aside,audio,canvas,  datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output, progress,section,time,video".split(','),
                i = e.length;
            while (i--) {
                document.createElement(e[i]);

            }
        })()
    </script>
    <style>
        time {
            font-style: italic;
        }
    </style>
      ...

Sorry for the horrible indentation but I am using a tablet. Anyway please take a look at the script tag and at that if condition.

Answers


@cc_on Statement is the conditional compilation flag for IE(< 11) browser

Quote from MSDN

@cc_on Statement (JavaScript)

Activates conditional compilation support within comments in a script.

Caution

Conditional compilation is not supported in Internet Explorer 11 Standards mode and Windows Store apps. Conditional compilation is supported in Internet Explorer 10 Standards mode and in all earlier versions.

/*@cc_on @*/
/*@
    document.write("JavaScript version: " + @_jscript_version + ".");
    document.write("<br />");
    @if (@_win32)
        document.write("Running on the 32-bit version of Windows.");
    @elif (@_win16)
        document.write("Running on the 16-bit version of Windows.");
    @else
        document.write("Running on a different operating system.");
    @end
@*/

so

if(!/*@cc_on!@*/0)

If your browser doesn't know conditional compilation (other than IE < 11), the expression will be:

if(!0) // ==> TRUE

otherwise it will be:

if(!!0) // ==> FALSE

Need Your Help

Inspecting STL containers in Visual Studio debugging

c++ visual-studio debugging stl

If I have a std::vector or std::map variable, and I want to see the contents, it's a big pain to see the nth element while debugging. Is there a plugin, or some trick to making it easier to watch STL