ouyang789987 / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Not initialized 'main' (or 'h') variable in script #400

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the script:
...
        plugin = false,
        domLoadFnArr = [main],
        regObjArr = [],
...

'main' is not declared at this point, and this causes problems in various tools 
when compressing 
the file. (The corresponding variable in the already compressed file is 'h').

Example with google's compressor:
11-Nov-2009 14:28:35 com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: ../src/main/resources/js/lib/swfobject.js:20: ERROR - Variable 
referenced before 
declaration: main
        domLoadFnArr = [main],

Removing the 'main' seems to fix it.

Original issue reported on code.google.com by algesten@googlemail.com on 11 Nov 2009 at 1:30

GoogleCodeExporter commented 9 years ago
We supply a YUI compressed version of the library in the download and outline 
the 
steps to do this yourself with YUI compressor here:

http://code.google.com/p/swfobject/wiki/how_to_compress

So changing the code to support various compression tools is not high on the 
list of 
priorities.

I have marked the defect priority as such, but thanks for bringing it to our 
intention.

Original comment by aran.rhee@gmail.com on 12 Nov 2009 at 1:46

GoogleCodeExporter commented 9 years ago
This is an easy fix, and the suggestion follows best practices (declaring a 
variable/function before using it). Bumping up the priority.

Original comment by platelu...@gmail.com on 16 May 2011 at 5:08

GoogleCodeExporter commented 9 years ago
Experimented with linting the entire library to ensure all vars are declared 
before first use, but this led to too many changes. For now I simply fixed the 
specific example provided in the issue ticket.

Original comment by platelu...@gmail.com on 20 May 2011 at 10:33