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

3.0.0+ not working in IE 11 #29

Open
joebochill opened this issue Jul 22, 2019 · 7 comments
Open

3.0.0+ not working in IE 11 #29

joebochill opened this issue Jul 22, 2019 · 7 comments

Comments

@joebochill
Copy link

Version 3.0.0+ is not working with IE 11.

Object doesn't support property or method 'closest'

I'm using it as follows:

_action(evt) {
  if (!condition) { return; }
  else if (!evt.target.closest('.class')) {
    this._doSomething();
  }
}

logging evt.target.closest is undefined.

The error log also spits out:
Object doesn't support property or method 'repeat', which is not coming from my code.

If I drop back down to version 2.0.2, everything works fine.

@markdavies
Copy link

Same issue here - 2.0.2 is working fine

@IndProgo
Copy link

There is a breaking change between versions
For Node usage, run closest with your window object:
const elementClosest = require('element-closest');
elementClosest(window); // this is used to reference window.Element

@diverent2
Copy link

const elementClosest = require('element-closest');
elementClosest(window); // this is used to reference window.Element

While confusing, this actually does the job. I think the docu and description are quite confusing and one might think import 'element-closest' would do the trick. Sadly this isn't the case.

You need to initialize the plugin using elementClosest(window); in a node context (eg. webpack, gulp etc.)

@wouterkroes
Copy link

It does work in browser/IE11 context, but for me it meant importing import 'element-closest/browser'.

@seyfer
Copy link

seyfer commented Jan 8, 2020

@wouterkroes would be great to have it in README.

@wouterkroes
Copy link

Yeah I agree! But I am not a owner/contributor of this repo. Maybe @jonathantneal could add it himself?

@diverent2
Copy link

Ups totally forgot to open the PR 🤦‍♂😅
Here we go :D #30

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

6 participants