I am working on a website globalization project that includes (we, the supplier), offering our customers to embed a script tag on their home / source site. The script tag is needed to help our customers become global, and part of the solution embodies a user interface that runs based on specific end-user criteria.
The user interface is built using jQuery, which we really cannot expect that our customers will embed them on their pages, not to mention version mismatches, will be difficult to solve. Therefore, our third-party library loads its own version of jQuery, although it is named differently to avoid conflicts.
However, such a mechanism requires that we rename all jQuery instances to something that will help us avoid name collisions with another jQuery instance (if present) and makes it very difficult to manage the processed jQuery (MY_Query in the examples below), not to mention the upgrade.
for instance
jQuery = window.jQuery = window.$ = function( selector, context ) {
becomes
MY_JQuery = window.MY_JQuery = window.MY_Q = function( selector, context ) {
In an ideal world, we and the client will have one version of jQuery on the site, and we will both use it to our advantage. But this would mean that the jQuery update would require significant testing on both sides (while a modified version of jQuery is contained), and that any desired plugin would require the client to add the appropriate script tags to their site, which sparked a political discussion between the two sides about which versions will win.
So, can I control our version of jQuery (with plugins) on the client site without having to rename all jQuery instances with something like MY_Query with the above limitations?
source share