Double colons in function declaration in Javascript?

房东的猫 提交于 2019-12-01 03:21:47

问题


Today I found this code snippet:

<object ID="FF" CLASSID="clsid:guid" CODEBASE="url" VIEWASTEXT></object>
<object ID="FileSaver" CLASSID="clsid:guid" CODEBASE="url" VIEWASTEXT></object>
…
<script language="javascript">
    function FileSaver::OnFinished(Status){…}
    function FF::OnFinished(Status){…}
</script>

I can't find anything relevant to explain this syntax. Is it really javascript? Is it correct? If not, how the code should look like?

This is a single page without external script links. Note that function declarations are directly inside <script> block.


回答1:


Thanks for everyone who looked into this.

Anyway, just as one could expect, not after five minutes after submitting the question, I found How to handle an ActiveX event in Javascript question about ActiveX callback handlers in IE, so it answers the main part of the question. As well, as the question that @outis has linked.

But I can't find any documentation on MSDN and that's troubling.

Conclusion: this is IE-specific ECMAScript extension for event handler declaration.



来源:https://stackoverflow.com/questions/6185878/double-colons-in-function-declaration-in-javascript

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