Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] JavaScript editor: 'window' is not defined

Hi Jon,

Welcome to the list. We're using JSLint to do some basic analysis of your _javascript_ and as you've found it's very picky about the use of globals (and frankly a lot of other things).
The rational is that neither "window" or "alert" are part of the language and not guaranteed to be defined (for example when running with the Rhino engine).

Now in your case I imagine you "do" know that they will be defined so to avoid getting the error markers you can put:...

/*global window alert*/

... at the top of your file and JSLint will recognize this and stop complaining.

Naturally, what you're doing is an incredibly common case and we do want to avoid turning people off Orion inside of 30 seconds so what we should be doing is something like downgrading the message (to say a warning) for common globals like what you describe and provide a suggestion on how to fix the problem. JSLint is not the most flexible tool in the world here but this is an issue we recognize.

-Simon

Inactive hide details for Jon Kleiser ---03/22/2011 04:59:28 AM--- Hi,  In my very first test of the code editor at orionhub.orJon Kleiser ---03/22/2011 04:59:28 AM--- Hi, In my very first test of the code editor at orionhub.org, I entered


From:

Jon Kleiser <jon.kleiser@xxxxxxxxxxx>

To:

<orion-dev@xxxxxxxxxxx>

Date:

03/22/2011 04:59 AM

Subject:

[orion-dev] _javascript_ editor: 'window' is not defined

Sent by:

orion-dev-bounces@xxxxxxxxxxx




 Hi,

In my very first test of the code editor at orionhub.org, I entered
this line ...

window.alert("hello!");

... and saved it as hello.js. I then got a red error icon to the left
of this line saying "'window' is not defined." If I changed it to ...

alert("hello!");

... and saved it, I got "'alert' is not defined."

I don't think these lines should be flagged as errors. ;-)

/Jon
_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/orion-dev


GIF image

GIF image


Back to the top