Standard: new Image() is no-undef

Created on 10 Jul 2016  Â·  2Comments  Â·  Source: standard/standard

When using HTMLImageElement as new Image() standard triggers a no-undef warning. Is this expected? I mean, Image is global... always :/

question

Most helpful comment

@sospedra we tend to limit the amount of globals exposed in the browser, because there are so many of them. Only window and document are typically exposed. Try running new window.Image() instead. Cheers!

All 2 comments

It is, in the "browser" environment. Use /* eslint-env browser */ at the
beginning of your file, or (recommended) simply use window.Image.

On Mon, Jul 11, 2016, 12:29 AM Rubén Sospedra [email protected]
wrote:

When using HTMLImageElement
https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement as new
Image() standard triggers a no-undef warning. Is this expected? I mean,
Image is global... always :/

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/feross/standard/issues/562, or mute the thread
https://github.com/notifications/unsubscribe/AAEikZmz6I0Y3UUa0lEuv3_Z-Qdw9FbOks5qUR3vgaJpZM4JI3f3
.

@sospedra we tend to limit the amount of globals exposed in the browser, because there are so many of them. Only window and document are typically exposed. Try running new window.Image() instead. Cheers!

Was this page helpful?
0 / 5 - 0 ratings