Jump to content

Implied Global Document - Jslint


madsovenielsen
 Share

Recommended Posts

I really dont know... how do i make document. local ? putting it in a local variable ? what is the best way ??/mads
If you made it local, it wouldn't have the getElementById() method. You actually do want your document variable to be global.If you really did want to make a local document variable, you would use the var keyword:
var document = new Object();

Link to comment
Share on other sites

If you made it local, it wouldn't have the getElementById() method. You actually do want your document variable to be global.If you really did want to make a local document variable, you would use the var keyword:
var document = new Object();

Okay. i understand. but why does JSlint think having a global document. is an error ?to avoid name collisions ?/mads
Link to comment
Share on other sites

I really don't think it's an error. I think it's just a notice. Select "Assume a browser" in the options before validating your code.

Edited by Ingolme
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...