Javascript/Jquery commenting causing errors in IE

一笑奈何 提交于 2019-11-28 14:00:51

You might be thinking of docblock commenting, which you would want to wrap in block comment syntax:

/**
 * Function does this
 * @param <string> $str The string
 * @param <array> $arr The array
 * @return <bool> true if string is in array, false if not
*/

I can see IE just being stupid. Odds are even if there is an explanation for why your //@ didn't work, it'll likely be a really stupid one, and odds are that only a small percentage of us would even be able to recreate it on our version of IE.

IE is the only browser to my knowledge that looks at conditional comments, so I can see them having a different comment parser than all other browsers which would conflict with otherwise proper code.

It does indeed look like some kooky IE conditional comment support. It appears that if @ is the first character of a comment (whether it starts with //@ or /*@, then IE looks for a conditional comment directive after the @ sign. See http://msdn.microsoft.com/en-us/library/8ka90k2e(v=vs.94).aspx for some examples.

AlienWebguy's suggestion should work because the first character of the comment is *. You could probably also just put a space before the @ sign:

// @ describe function
// @ params: param1 - function, param2 - function
// @ etc....
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!