4 ms·
Hello, I explicitly asked for it: > How should one do the same with vanilla JS? And you said: > With the code here
by fabiospampinato 5y ago
Hello, I explicitly asked for it:
> How should one do the same with vanilla JS?
And you said:
> With the code here
- earthboundkid 5y agoI used jQuery back in the day and I never used namespaces, so I had no idea what ns.click meant. I don't really see why it's a desirable feature now. It just seems like a weird artifact of the fact that jQuery predates CustomEvents. I mean, I guess if there were no CustomEvents, it would be useful, but they exist now, so just use them.
- fabiospampinato 5y agoFor the record the code you linked to doesn't implement event delegation either, which is something pretty useful that even more modern libraries like React use under the hood. Here's [0] an article about the usefulness of namespaces, it has use cases beyond custom events, which have been implemented a real long time ago. [0]: https://css-tricks.com/namespaced-events-jquery/ https://css-tricks.com/namespaced-events-jquery/