News for hackers. Stuff that matters.
Re:A little bit of plain JavaScript can do a lot by felixfbecker on Sunday June 21, 2020 @05:54AM (#23591044)
getAncestor is built-in: element.closest() :)
Re:A little bit of plain JavaScript can do a lot by austincheney on Sunday June 21, 2020 @10:45AM (#23592283)
Slow. It uses a selector as an argument, which requires a parse step. It doesn’t take much effort to write something substantially better.