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

Update polyfill.js #1

Merged
merged 1 commit into from Mar 15, 2019

Conversation

Projects
None yet
3 participants
@lyckligtax
Copy link
Contributor

lyckligtax commented Mar 13, 2019

Prevent Internet Explorer from throwing an exception as its document does not have a body property.

[Fix] Prevent IE from throwing an exception as its document does not …
…have a body property.

This happens when the script exists in the `<head>`, where
`document.body` does not yet exist.
@ljharb

This comment has been minimized.

Copy link
Owner

ljharb commented Mar 13, 2019

Which version of IE? I tested this code in IE 6.

@ljharb

This comment has been minimized.

Copy link
Owner

ljharb commented Mar 13, 2019

(it's possible that document.body doesn't exist until it's inside the body tag; if so, I might need a different approach here)

@lyckligtax

This comment has been minimized.

Copy link
Contributor Author

lyckligtax commented Mar 14, 2019

The Version in question was IE 11.
but your're absolutely right. The body-attribute is not appended at time. I checked with other sites.

Background:
We're using react-dates which utilizes react-outside-click-handler which utilizes document.contains (thx for all your time and contributions to all this :-))

The created React-Component is not rendered and mounted to the DOM immediately which results in checking for the polyfill before the body is attached to the document.

This effect occured as of v.1.2.3 of react-outside-click-handler where, afaik, the way the polyfill was added changed. If I'm not mistaken.

I'm by far no IE expert so I do not know of a more suitable solution to this. Any chance you can enlighten me on this?

@cwrs

This comment has been minimized.

Copy link

cwrs commented Mar 14, 2019

We have the exact same problem (IE11 and no body tag present when executed) and have to downgrade the react-outside-click-handler for now. Would be great if the pull request could get merged.

@ljharb ljharb force-pushed the lyckligtax:patch-1 branch from 8612b51 to 7639260 Mar 15, 2019

@ljharb

ljharb approved these changes Mar 15, 2019

@ljharb ljharb merged commit 7639260 into ljharb:master Mar 15, 2019

@ljharb

This comment has been minimized.

Copy link
Owner

ljharb commented Mar 15, 2019

v1.0.1 published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.