Hacker News new | past | comments | ask | show | jobs | submit login

Is not the same thing as it is a Element method, not NodeList one, so you will would need to map it instead. Because NodeList doesn't have the .map method you would also need to transform it to a Array first.

So the actually drop-in replacement of `$(foo).closest(bar)` would be something like:

    Array.from(document.querySelector(foo)).map(el => el.closest(bar))



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: