Any plans to remove jQuery dependency?
Any plans to remove jQuery dependency?
morganrob
Posts: 18Questions: 7Answers: 2
We've largely eliminated jQuery as a dependency in our web apps with the exception of any pages using DataTables. Any plans?
This discussion has been closed.
Answers
There was a thread about this about a month ago which I now can't find...
Currently no, there are no plans to remove jQuery as a dependency. Yes, it absolutely could be done, but it would significantly increase the size of the DataTables library since we'd just need to reimplement a fair amount of what jQuery gives us. It would also reduce the compatibility of DataTables since I wouldn't implement events for legacy browsers.
Given the significant increase in the size of the library and the amount of maintenance it would take, my feeling is that any benefit of removing jQuery (i.e. code size) would be out weighted by those problems.
That said, my current plan is to effectively introduce a compatibility layer. So all the jQuery dependent stuff goes through a specific layer that can call out either to jQuery, or some other library. That is something I plan to look at for v2.
Allan
Little update on this - I have recently looked into use the Cash JS library as a replacement for jQuery, but its missing some API methods that jQuery exposes - see the discussion here.
That is the lib I'm currently most interested in using to provide a layer of DOM manipulation and event handling to be able to replace jQuery as a dependency (but still 100% support it - just that it would be replaceable if required).
Allan
The points made above make sense. My curiosity stemmed from reducing my reliance on jQuery in exchange for newer ES6+ APIs and babel transpiling, which may already be required for frameworks like React.
Given that there is some heavy lifting in the transpilation, reducing the amount of load (like that of jQuery) made more sense. I favor the transpilation as it prepares for future proofing the code. In the future, I expect a broader range of browsers to require less Polyfills and so native APIs can be used, which fulfill a lot of the needs that jQuery provide.
From what I gather, you are already considering this, which is why I imagine you might be abstracting out that layer.
This is indeed an interesting topic.
Well, I am actually happy with the current datatables and jquery. However, I can see the benefits of using different libraries and I can predict this is an inevitable thing.
I tried to involve ReactJS in my app but it got complicated so I am just waiting for the official support in the future.