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

Need to check if container option is provided #5619

Closed
jingsam opened this issue Nov 8, 2017 · 0 comments
Closed

Need to check if container option is provided #5619

jingsam opened this issue Nov 8, 2017 · 0 comments

Comments

@jingsam
Copy link
Contributor

jingsam commented Nov 8, 2017

Recently I am reviewing the source code. As I know, the options.container must be provided as string or HTMLElement. I think bellow code would fail to validate container if it is undefined or other types.

https://github.com/mapbox/mapbox-gl-js/blob/master/src/ui/map.js#L280-L289

        if (typeof options.container === 'string') {
            const container = window.document.getElementById(options.container);
            if (!container) {
                throw new Error(`Container '${options.container}' not found.`);
            } else {
                this._container = container;
            }
        } else {
            this._container = options.container;
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants