4 ms·
Nikanj isn't wrong (and is funny), but I think the other (more justifiable) reason is that jQuery largely isn't necessary anymore: when it came out, there were
by wfleming 10y ago
Nikanj isn't wrong (and is funny), but I think the other (more justifiable) reason is that jQuery largely isn't necessary anymore: when it came out, there were an uncountable number of browser incompatibilities that needed painting over, and APIs for remote requests, DOM querying & manipulation and the like were very immature, so a library to make everything usable was extremely valuable.
Now, those APIs are mature & standardized & it's generally not too hard to write vanilla JS that works across all the major browsers.
I don't think jQuery has failed, but for the kind of baked-in functionality Rails wants it's not really needed, and there are good reasons not to pack another dependency into your framework if it will increase page download size & is increasingly unlikely to be used by the framework's users.
- dom0 10y agoExactly. For my little JS needs I just use vanilla JS (even though the APIs are poor and the language is worse), since it will very likely work across all browsers I care about (recent FF/Chrome/Edge).
- mercer 10y agoI recall reading that element.querySelector(All) was inspired by jQuery. If true, it means jQuery was so much of a success that parts of it were implemented natively in browsers! (I couldn't confirm this by googling, so if anyone can confirm or deny that this is the case I'd love to know!)
- gsnedders 10y agoTo some degree, it's absolutely the case that JS frameworks of the era have shaped what browsers have done in the late-00s. I can't remember the detail of document.querySelectorAll; it was first proposed around the time jQuery was originally released. element.querySelector I think was largely inspired by jQuery's usage of it (in part to make it easier to run more of jQuery's selectors natively!).