Do we still need jQuery in XenForo?

ibnesayeed

Well-known member
Gone are the days when browsers were intentionally implementing features in an incompatible way from each other for market dominance and monopoly. As a result, making the life of developers difficult who would like to support all browsers. And jQuery was born to rescue! Since then browsers came a long way. Many new APIs are being proposed as standards and gradually being adopted by all mainstream browsers now. No wonder, the internet is full of articles like "Do you still need jQuery?", "You might not need jQuery!", and "How to get rid of jQuery?".

If XF is to get rid of jQuery, how much work would it be and what might be some advantages or disadvantages of it?
 
Apart from browser compatibilities, the two most used functions of jQuery are the shorter syntax and the organized plugin structure.
Of course XF could ditch that and write its own library, but that would mean even a more higher and complex learning curve with actual no benefit other than probably a really well bespoke and maybe some KB lighter file.
Considering what XF achieves with JS, nope, right now, it can't achieve all of that with native browser methods. Besides that, let's not forget it, jQuery is just plain JS, which itself is a browser standard.
 
We’re not currently planning to move away from jQuery. If we were, then we would have moved away when we had the opportunity when developing XF2.

Removing a dependency like that also isn’t going to happen in even a second point release, so there’s no chance we would remove it before XF 3.0 and there are currently no imminent plans for 3.0 vs just continuing to release second point versions for 2.x.

It’s true that “you might not need” jQuery. But then why do you need any other framework? Why use Symfony and Laravel vs just plain PHP. Why use React, jQuery etc. when you can just use plain JavaScript?

There are still benefits to using jQuery. In fact our code actually uses native JS in some places; it just depends what’s appropriate. The benefits of jQuery may be even more lessened as newer versions of ECMAScript become supported or, more significantly, we no longer support older browsers.

But, even if the benefits of jQuery is lessened, there’s certainly very few disadvantages of continuing to use it.
 
Top Bottom