I'm noticing a strange behaviour with IE10.
I have a javascript file with this content:
var x = 1;
//@deprecated, use static version
var y=function(interval){
console.log(interval);
};
The file is encoded with UTF-8.
I have an html file with meta tag
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
If the previous file is included via <script>
tag, it works.
If I instead download the file creating a script element via javascript and appending the script in the head:
var script = document.createElement('script'),
head = document.getElementsByTagName('head')[0];
script.type= 'application/javascript';
script.src = ''; // omissis
head.appendChild(script);
It works for IE11 but not for IE10: it is throwing error
(SCRIPT1004): expected ';'
The strange thing is: the line and column number of the error are pointing to the comma after the //@deprecated
: but this should be a comment, it should not throw any error.
BTW: the javascript that creates the script tag and append it to the head is working for all javascript files and for all browser. It seems to be broken only if inside the file there is the //@deprecated
comment.
Thank you, cheers