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

Issues when document.body is null? #75

Open
cycomachead opened this issue Oct 27, 2017 · 4 comments
Open

Issues when document.body is null? #75

cycomachead opened this issue Oct 27, 2017 · 4 comments

Comments

@cycomachead
Copy link

In another round of mysterious errors...

I've seen some cases where it looks like the mutationobserver is trying to be set up before the DOM is ready.

I'm seeing the error with this line:

this._observer.observe(this._document.body, { attributes: true, subtree: true, childList: true });

Errors returned: "TypeError: Argument 1 of MutationObserver.observe is not an object."

It's happened in FF 55,56 on Linux, Mac and Windows as well as IE 11 and Edge.

It looks like the readyState checking all makes sense, so I'm not sure what's the cause yet.

@robdodson
Copy link
Collaborator

Do you have steps to reproduce or a full stack trace by chance?

@robdodson
Copy link
Collaborator

I'd be interested to know the value of this._document when you hit that error.

@rodneyrehm
Copy link

While I can't reproduce this problem, I have a few ideas to share:

  • you're dealing with a non-HTML document (e.g. SVG) and therefore don't ever have document.body set to anything useful (should be a problem in every browser)
  • you've fallen victim to one of the issues described on MDN (worked around by jQuery) (should not be a problem in Firefox)
  • something removed <body> from the DOM before the document loaded, and re-attached it right after it loaded, but before inert.js could initialize (should be a problem in every browser)

@robdodson
Copy link
Collaborator

Hey @cycomachead are you still hitting this issue? Do you think it might be possible to log the value of this._document and this._document.body in your build? You'd need to modify the version of inert you're running.

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