Let language be JavaScript.
NOTE: As with script elements, the MIME type of the script is ignored. Unlike with script elements, there is no way to override the type. It's always assumed to be JavaScript.
I get it, HTML5 doesn't like versioning (ie DOCTYPE html). But it is needed sometimes, like for incompatible JavaScript versions.
https://developer.mozilla.org/en/New_in_JavaScript_1.7
I wish to use features introduced in JavaScript 1.7, like generators (yield) and block scope (let), but because they introduce new keywords, you need to explicitly tell which version you wish to use, using:
- Code: Select all
<script type="application/javascript;version=1.7">
But with WebWorkers, this is not possible, as quoted above.
I know this particular example (currently) only works in gecko-based browsers, but there are other cases where this could be needed (future JS/EcmaScript versions?).
[tested with Firefox 3.1b3, WebWorker scripts default to pre-JS1.7 interpretors]