Hacker News new | ask | show | jobs
by franciscop 1983 days ago
Thanks! But jQuery has not really moved over, compare "addClass" in jQuery vs UmbrellaJS:

- Umbrella 6 lines (max col 55): https://github.com/franciscop/umbrella/blob/master/src/plugi...

- jQuery 35 lines (max col 83): https://github.com/jquery/jquery/blob/master/src/attributes/...

Yes I reuse methods there to make my life easier like `.eacharg()`, but jQuery as well with `getClass()`. The difference is that UmbrellaJS is using the native `classList.add`, while jQuery is doing string concatenation and cleaning it up heavily. jQuery does not even use `className`, it uses the even older `.setAttribute()`.

Why they cannot just move over? I did try to move them over, the thing is that the edge cases of jQuery were solidified into features as people found them and wrote tests. And jQuery is very big on not breaking behaviour even for small things, so the only way to maintain the current exact behaviour is to have the current exact code, hence you cannot just migrate it over.

1 comments

> jQuery is very big on not breaking behaviour even for small things

You answered your own question :)

Yes the "Why they cannot just move over?" was a rhetorical question since I was just explaining that. The larger point being that jQuery being still stuck in doing things manually is detrimental, hence devs could/should consider small modern alternatives even if they want an API similar to jQuery.