celadonz
celadonz

Reputation: 391

What does IE use //@ in javascript for?

So, a bug in a piece of javascript revolved around code similar to :

<script>
    (function() {
        if (true) {
            //@todo: do we need to set total or -- ?
            alert('hello?');
        }
    })();
</script>

In the larger system IE complained "Expected ';' ". In the small scale example IE simply caused a warning about blocking ActiveX controls.

Obviously, "//@" has some context to activeX controls in IE. I was unable to find this as searching for the symbols was useless, and any search about special comments in IE result in the conditional html comments. I am just curious how the //@ are supposed to be used in IE.

Upvotes: 10

Views: 321

Answers (2)

ThiefMaster
ThiefMaster

Reputation: 318578

The IE JScript engine supports conditional comments which turn comments written in a particular way into code (partially). However, you are not using those.

In your case it seems to be a way to tell e.g. an IDE that there is a TODO item. The error you got is most likely unrelated.

Upvotes: 4

kevin628
kevin628

Reputation: 3526

Unless there's some quirk about IE that I don't know, the //@todo is just commenting fluff that some programmers use when they are too lazy/don't know how to implement something.

Upvotes: 0

Related Questions