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

Breaks if script tag is in <head> #23

Open
iangilman opened this issue Nov 19, 2015 · 3 comments
Open

Breaks if script tag is in <head> #23

iangilman opened this issue Nov 19, 2015 · 3 comments

Comments

@iangilman
Copy link

The code expects window.document.body to already exist when it's loaded, which isn't true if the script tag is in . I realize putting the script tag at the bottom of the body is considered best practice, but the library shouldn't just break if you don't do it.

At the very least, there should be some indication that that's what the issue is.

@iangilman
Copy link
Author

It shouldn't have to...as far as I can tell, nothing needs to happen until after new Tooltip is called. The reason there's an error is just that it makes its own local reference to window.document.body right at the beginning. It could easily do that in the first new Tooltip call.

On the other hand, if it is a necessary limitation, it should be mentioned during the installation instructions on http://darsa.in/tooltip/ and if people ignore that, it should generate a console.error that explains the situation.

@RandyR34
Copy link

Second this!!! Thanks Iangilman, spent an hour trying to resolve "Type Error: Body is Null".

This should have some warning or instruction to include at the very bottom.

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
@iangilman @RandyR34 and others