These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:06 pm Advanced search

Javascript version in WebWorkers

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

Javascript version in WebWorkers

Postby tom » Mon Mar 23, 2009 9:38 pm

(from WebWorkers spec draft, section 4.6 Processing model)

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]
tom
<h6>
 
Posts: 1
Joined: Mon Mar 23, 2009 9:04 pm

Postby PMB9 » Tue Mar 24, 2009 5:06 pm

Code: Select all
the MIME type of the script is ignored

AH! This is very bad. So if this file is a html file with integrated js, the file will be executed as JavaScript with a lot of errors.?

And what about other programming languages?
PMB9
<h3>
 
Posts: 50
Joined: Sat Jan 26, 2008 5:38 pm


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest