Is the function form of "use strict" necessary in a web worker

1.1k views Asked by At

JSHint warns:

'Use the function form of "use strict".'

In a file that has been designated as a web worker using

/* jshint worker:true */

From my testing on Chrome and Firefox it seems that:

  1. If you put "use strict" at the top of a web worker javascript file, it will not cause strict mode to be applied to any other files, including those imported via importScripts
  2. If you put "use strict" at the top of a javascript file imported using importScripts, it will not apply strict mode the the file that included it.

It seems to me that the warning should not apply to the worker context, because the typical issues with strict mode bleeding across files does not apply in a web worker environment.

Is this merely an oversight in jshint, or is there a legitimate reason to require the function syntax?

0

There are 0 answers