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

IE11 throws TypeError: Object doesn't support property or method 'contains' #75

Closed
zachguo opened this issue Aug 25, 2020 · 4 comments · Fixed by #81
Closed

IE11 throws TypeError: Object doesn't support property or method 'contains' #75

zachguo opened this issue Aug 25, 2020 · 4 comments · Fixed by #81

Comments

@zachguo
Copy link
Contributor

zachguo commented Aug 25, 2020

rc-align v4.0.3
antd v4.4.3

if (!document.contains(target)) return;

@patrickomeara
Copy link

This issue is holding our upgrade up as well. Looking forward to getting the PR merged.

@zachguo
Copy link
Contributor Author

zachguo commented Sep 2, 2020

We temporarily work around this by replacing the document.contains string with document.body.contains using a webpack loader.

  module: {
    rules: [
      ...,
      // replace 'document.contains' with 'document.body.contains' for IE compatibility, util rc-align fixes it
      {
        test: /\.js$/,
        include: [path.resolve(__dirname, "node_modules/rc-align")],
        loader: "string-replace-loader",
        options: {
          search: "document.contains(",
          replace: "document.body.contains("
        }
      }
    ]
  }

@patrickomeara
Copy link

Ah, thanks @zachguo that's great info. Hopefully the fix isn't too far away.

@pig800509
Copy link

+1, waiting.....

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

Successfully merging a pull request may close this issue.

3 participants