mootools / mootools-core

MooTools Core Repository
https://mootools.net
2.65k stars 510 forks source link

mootools-core 1.5.1 uglify.js #2717

Closed Shoplifter closed 9 years ago

Shoplifter commented 9 years ago

when i minify mootools-core 1.5.1 using uglify.js i get this error message:

uglifyjs js/mootools-core-1.5.1.js --compress --mangle -o js/mootools-core-1.5.1.min.js

util.error: Use console.error instead
WARN: Side effects in initialization of unused variable instanceOf [js/mootools-core-1.5.1.js:51,4]
util.error: Use console.error instead
WARN: Dropping unused function borderBox [js/mootools-core-1.5.1.js:4666,9]

dont know what that means, any idea?

SergioCrisostomo commented 9 years ago

Side effects in initialization of unused variable instanceOf

This is because we use var instanceOf = this.instanceOf = function(item, object){ in Core.js and Uglify probably reacts to the first assignment of this "double assign", since this.instanceOf is not defined before that line.

Using

var instanceOf;
instanceOf = this.instanceOf = function(item, object){

will not generate the warning, which made me reach the conclusion above.

Dropping unused function borderBox

borderBox is a private function used in Element.Dimentions in the compat layer. We could add a comment block around this code so it would not be present in the no-compat build.


Having this said, I think its safe to ignore those warnings.

Shoplifter commented 9 years ago

thank you for digging into this and providing comprehensive answer.