Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commented code is executed, causes error #65

Open
netpoetica opened this issue Nov 28, 2014 · 2 comments
Open

Commented code is executed, causes error #65

netpoetica opened this issue Nov 28, 2014 · 2 comments

Comments

@netpoetica
Copy link

Using this code, including comments on bottom, in Chrome on Mac OSX, causes this error without any stacktrace

Uncaught SyntaxError: Unexpected end of input

The code (must include bottom two lines which are commented out)

var SVG = require('svg.js');

var canvas = document.createElement("canvas");
canvas.width = 500;
canvas.height = 500;
document.body.appendChild(canvas);


//var draw = SVG('drawing').size(300, 300);
//var rect = draw.rect(100, 100).attr({ fill: '#f06' });

If you remove the two commented lines, no error is produced. No error is produced if you use multiline comments as well:

/*
var draw = SVG('drawing').size(300, 300);
var rect = draw.rect(100, 100).attr({ fill: '#f06' });
*/

From a quick glance over the code, I'm thinking this might be an issue I should report to javascript-editor repo at https://www.npmjs.org/package/javascript-editor - do you agree?

@kumavis
Copy link
Collaborator

kumavis commented Mar 3, 2015

your guess makes sense, its a little hard to get a look at the generated code on the requirebin page to debug

@mauriciopoppe
Copy link
Collaborator

SVG('drawing') will execute document.getElementById('drawing') and such an element didn't exist in the dom before, please have a look at this gist now that it's possible to edit the contents of the body
http://requirebin.com/?gist=c9ba92aaaad84c2cdc05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants