admin管理员组文章数量:1300049
So this post is not so much of a "please help me fix it" post as much as it is a "why would changing that make it work?". So I had some javascript/jquery written that was working in firefox and chrome, but IE threw errors.
I could not figure it out even with the helpful posts from users here at stackoverflow. I eventually stumbled upon the answer (as I seem to find myself doing a lot with coding).
I was doing a somewhat rigorous style of menting taught to me by one of my puter science professors where a function would have menting such as this:
//@ describe function
//@ params: param1 - function, param2 - function
//@ etc....
So I foolishly threw this into my javascript only to find out that IE really did not care for this much at all. When I removed the @ symbols the code worked perfectly.
So my question is why this caused errors in IE? Shouldn't whatever follows the '//' ments not matter?
So this post is not so much of a "please help me fix it" post as much as it is a "why would changing that make it work?". So I had some javascript/jquery written that was working in firefox and chrome, but IE threw errors.
I could not figure it out even with the helpful posts from users here at stackoverflow. I eventually stumbled upon the answer (as I seem to find myself doing a lot with coding).
I was doing a somewhat rigorous style of menting taught to me by one of my puter science professors where a function would have menting such as this:
//@ describe function
//@ params: param1 - function, param2 - function
//@ etc....
So I foolishly threw this into my javascript only to find out that IE really did not care for this much at all. When I removed the @ symbols the code worked perfectly.
So my question is why this caused errors in IE? Shouldn't whatever follows the '//' ments not matter?
Share Improve this question edited Jul 27, 2013 at 7:52 Dave Chen 11k8 gold badges41 silver badges71 bronze badges asked Jul 8, 2011 at 23:04 Nathaniel WendtNathaniel Wendt 1,2024 gold badges24 silver badges49 bronze badges2 Answers
Reset to default 8It does indeed look like some kooky IE conditional ment support. It appears that if @ is the first character of a ment (whether it starts with //@ or /*@, then IE looks for a conditional ment directive after the @ sign. See http://msdn.microsoft./en-us/library/8ka90k2e(v=vs.94).aspx for some examples.
AlienWebguy's suggestion should work because the first character of the ment is *. You could probably also just put a space before the @ sign:
// @ describe function
// @ params: param1 - function, param2 - function
// @ etc....
You might be thinking of docblock menting, which you would want to wrap in block ment 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 ments, so I can see them having a different ment parser than all other browsers which would conflict with otherwise proper code.
本文标签: JavascriptJquery commenting causing errors in IEStack Overflow
版权声明:本文标题:JavascriptJquery commenting causing errors in IE - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741649612a2390393.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论