4 ms·
"we’re now able to drop jQuery as a dependency", interesting
by fasicle 6y ago
"we’re now able to drop jQuery as a dependency", interesting
- hnarayanan 6y ago... by replacing large parts with a native jquery-like implementation.
- dgb23 6y agoWhich results in much less js code shipped and better perf. Browsers have caught up to (almost) everything jquery does. Thanks jquery, you served us very well!
- andybak 6y ago> Browsers have caught up to (almost) everything jquery does. For me jQuery is mainly about an elegant, chainable API and all the DOM tools I'm likely to need on hand. I understand there's a bit of bloat but there's also lighter jQuery-alikes. I tried vanilla js recently and the native DOM APIs are fairly ugly in comparison with none of the quality of life stuff I got used to. What am I missing?
- inopinatus 6y agoThe point is that one framework should not depend on another. If you like jquery, no-one is stopping you using it.
- andybak 6y agoI wasn't specifically talking about Bootstrap. Parent post seemed to be making a general point about jQuery. > The point is that one framework should not depend on another. It's not hard to think of counterexamples unless you have very particular definitions of "depend" and "framework.
- inopinatus 6y agoThe counter argument would be that one framework should depend on another. Good luck with that.
- andybak 6y agoIt's debateable whether jQuery is a library or a framework. It's definitely at the frameworkey end of libraries of the libraryish end of frameworks. But if you'll admit the terms get murky in the middle then I think it's not controversial to assert that a framework can depend on a library without it offending the gods. So we're very quickly in the territory of "things reasonable people could disagree about" and quite far away from "glibly asserting that something isn't even up for debate".
- inopinatus 6y agoI’m not sure whether you’re debating the point or the terminology.
- andybak 6y agoI'm disagreeing with your fundamental point. It sounds truthy but I don't think it withstands scrutiny in this case.
- inopinatus 6y agoIn this specific case, Bootstrap does not need to depend on jQuery. The proof is that version 5 doesn’t. As arguments go, it doesn’t get any clearer cut. More fundamentally, interdependency is a disease infecting the entire JS ecosystem. The antithesis is the antidote.
- dgb23 6y agoI agree the API and the chaining are nice in some cases. And I agree that native JS is less pretty. But I personally don't use it anymore since a while now. I either use React/Next + Redux if they are a good fit, or just plain native JS otherwise. JQuery doesn't solve enough of a problem (anymore) for me to be worth loading and adhere to. If I do the latter then my code is often structured the same (per module). - defining some utility functions - setting up state and state-transformation / "top-level" functions - getting the DOM elements (once) - defining DOM mutations on those elements based on the state, usually call these "render" functions. - registering event handlers on those elements which call the top-level functions and pass the new state to the render functions. I know this is kind of a dumb/rigid approach, but it suits me well. There is not much obvious use for jQuery here. The only place where the nice chaining API would be useful are the DOM mutations (sometimes) but I haven't found this to be a huge deal. As soon as I need to do more AJAX, inserting/removing whole Nodes/NodeLists, have more involved state management and policy then jQuery doesn't help anyways and a more sophisticated framework is more fitting (like React/Next + Redux).