niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.59k stars 4.81k forks source link

Native keyword causes yuicompressor to fail #522

Closed adrian7 closed 7 years ago

adrian7 commented 9 years ago
function SVGNodeContainer(node, native) {
    this.src = node;
    this.image = null;
    var self = this;
    ...

native is a reserved word in java, thus compressor will fail.

usmonster commented 9 years ago

I also ran into this when compiling with the Closure Compiler, but then I realized that native is a formerly-reserved keyword and only affects browsers that implement ECMAScript <= 3, which basically includes only IE <= 8 and other older browsers that aren't supported by html2canvas.

The solution for Closure Compiler was to use the --language_in=ECMASCRIPT5 command line option, so it knows not to care about earlier ECMAScript rules. There might be something similar for YUI Compressor?

usmonster commented 9 years ago

@adrian7, this may have been fixed in the new alpha2 release--can you test it?