Earlier today Chris Coyier tweeted that he was in the process of rewriting one of his pens without jQuery:
Been trying to re-write this without jQuery: https://t.co/xvsZMKsfvL
I’m like 70% there but haven’t quite gotten it. jQuery is doing so much helpful DOM traversal here it’s a pain in the ass without it.
— Chris Coyier (@chriscoyier) August 29, 2019
Sparked by his tweet I decided to fork his pen and try to do it myself. Here’s the result:
A fun exercise if I say so myself, even though I’m not 100% satisfied with the manual traversal I needed to do (
.parentElement.parentElement — really?). Perhaps there’s a better way to do this?