JS Libraries Cripple Apps
September 17th, 2008 in web development | No Comments
I know the title sounds a bit extreme, but now that I’ve got your attention, let me explain. If you’re making a web app that’s meant to be embedded in other pages which you have no control over, choosing a JavaScript library will only limit the usefulness of your app to people already using that library. The problem emerges when a user tries to embed your app in a page already using a different library. Conflicts are bound to occur.
This is especially a problem when using Mootools because the developers don’t care if their library isn’t compatible with others. I’m seriously thinking of dropping Mootools from JibberBook and using POJS (I’m coining a new term here: Plain Old JavaScript) so it can be used by more people.
I know some libraries have a no conflict mode, but there’s also the less-than-desirable side effect of forcing visitors to download multiple JS libraries.
It’s our responsibility to come up with a solution. In the far future, I think the optimal solution would be to create a standard API that all JS library developers will agree to use. That might be a while off, but for now, an intermediate step would be to create wrappers for JS libraries to implement the same API. I’ve already created some simple wrappers for jQuery and Mootools for Valerie, but I don’t believe I have the expertise to create what’s needed. Any JavaScript guru out there willing to take up the challenge?

Hi, I'm Chris, a passionate freelance web developer. My languages of choice are PHP and JavaScript, and that's what you'll mostly find in my blog. You'll also find updates about 