Extend TMS WEB Core with JS Libraries with Andrew: jQuery
In previous articles in this series, we’ve covered some big JS libraries like Bootstrap and FontAwesome. But there’s another important JS library out there. It can be found lurking under approximately 75% of all websites globally. It first arrived on the scene more than 15 years ago. And it is likely to be with us for the foreseeable future, even though its use has started to decline. I’m talking of course about jQuery. But while you can use Bootstrap and FontAwesome in your TMS WEB Core projects without needing to resort to JavaScript coding, the same cannot really be said for jQuery. At its core, jQuery can be thought of as a kind of extension of sorts to the JavaScript language. Their motto is Write Less, Do More. We’ll be taking a look at where jQuery might find a good fit in TMS WEB Core projects, and also some of the unexpected challenges that might arise. Good jQuery First, the briefest of histories. jQuery first surfaced around 2006. It was a time when writing JavaScript code meant that you had to be very much aware of the target browser that would be running your code. Standards of the day were tenuous at best. And as the saying goes, the great thing about standards is that there are so many to choose from. jQuery offered developers a consistent approach to writing JavaScript (an API, essentially) which meant that you could write code using jQuery that would then work across many browsers. So naturally it rose quickly in popularity. In fact, it became so popular, particularly among new developers, that it has been said that some developers struggle to write actual Vanilla JavaScript (aka JavaScript that doesn’t make use of any frameworks like jQuery). Not surprising given how easy it has been to use jQuery when compared to the Vanilla JS equivalents of even just a few years ago. jQuery has also evolved over the years to keep up with current web trends, and perhaps has even helped drive to some degree the adoption of new browser technologies. Even if some of those technologies ultimately end up removing the need for jQuery in the first place. Progress, all the same. And given the almost ubiquitous presence of jQuery, many (previously, most) JS libraries have been built on top of it, further ensuring it has a long life ahead of it. Last time out, we looked at BigText, one such JS library, with jQuery as its only dependency. Bootstrap 4 was also dependent on jQuery, but this was removed for Bootstrap 5. Removing jQuery as a dependency seems to be a bit of a trend of late, perhaps ironically at the same time that many JS libraries are increasingly being released with variants that are specifically tailored to other (competing) JS frameworks. Less Good jQuery Being around for such a long time, and being actively improved all the while, naturally a good deal of bloat is destined to be part of the mix, as would be the case in any software product. For some projects, this will be the largest JS library in the project, dwarfing all others and negatively impacting the overall performance of the resulting web application. While I don’t doubt that this can be a real problem, we also […]
