DEV Community

Discussion on: Matching elements with selectors in JS

Collapse
 
sargalias profile image
Spyros Argalias • Edited

:(, sorry you lost days on this. Yeah in my experience polyfill issues are tricky to debug. You're right, Babel needs a polyfill for DOM methods. element-closest-polyfill seems to do the job well.

In the future, if you want to polyfill a lot of stuff automatically, Babel recommends using core-js and regenerator-runtime/runtime. (It mentions it at the top of the page for the deprecated babel/polyfill). However, those can be a lot of work and configuration, so specific polyfills like element-closest-polyfill are very good.

Thread Thread
 
djibe profile image
djibe

Hi, thanks for your reply.
I looked for a regenerator-runtime/runtime config with Rollup and Babel.
Didn't find so I ended up with temporary element-closest-polyfill.

Thanks for your answer.