Can someone explain how the beginning and end of the html5shim script works?
the script starts with /*@
and ends with @*/
like this:
/*@cc_on(function(a,b){function ........ (this,document);@*/
What is the /*@ @*/
doing?
I would expect the /* */ sequence to ment out all lines in between them, but since the script executes, that cant be the case here? I'm confused.
found at:
.js
Can someone explain how the beginning and end of the html5shim script works?
the script starts with /*@
and ends with @*/
like this:
/*@cc_on(function(a,b){function ........ (this,document);@*/
What is the /*@ @*/
doing?
I would expect the /* */ sequence to ment out all lines in between them, but since the script executes, that cant be the case here? I'm confused.
found at:
Share Improve this question edited Aug 22, 2011 at 21:23 cwallenpoole 82k26 gold badges132 silver badges174 bronze badges asked Aug 22, 2011 at 21:20 mikkelbreummikkelbreum 3,08110 gold badges39 silver badges41 bronze badgeshttp://html5shim.googlecode./svn/trunk/html5.js
2 Answers
Reset to default 15IE's JScript supports ‘conditional pilation’, a trick of hiding special browser-specific information in ments. The idea is that /*@...@*/
is such an unusual sequence of characters that it is safe to repurpose it to introduce this new syntax-level feature.
html5shiv uses it to create a piece of code that won't even try to run on most browsers (which, like you did, will interpret the whole thing as a mend), but which has special meaning to IE.
MS doc here. No other JS engine supports this. Typically you might favour more explicit behaviour-sniffing code instead, but if you really need to detect an IE feature that doesn't expose itself to sniffing otherwise, it can be handy.
It's an IE-ism for "conditional pilation": http://www.javascriptkit./javatutors/conditionalpile.shtml