Poll Results: Multiple JavaScript Libraries

Avatar of Chris Coyier
Chris Coyier on (Updated on )

The question was:

Do you ever use two JavaScript libraries on the same page?

My thinking in creating this poll was around two ideas:

  1. An excuse to educate people that using multiple libraries on the same page is generally a bad idea and not necessary.
  2. Uncover interesting scenarios where using multiple libraries on the same page was useful/required.

I was specifically talking about the big libraries that are general-purpose helper libraries for making working with JavaScript easier: jQuery, MooTools, Dojo, Prototype, etc. These have DOM manipulation tools, selector engines, AJAX helpers, etc. I think this is what most people think of when thinking “library.” It is in using multiple of these libraries that is generally frowned upon and deemed unnecessary. Besides the fact that it’s extra bandwidth and can cause conflicts if not managed properly, these libraries do many of the same things and there is little benefit to a bunch of duplicate functionality.

Here are the results:

If you see this, your browser may not support SVG, or a content aggregator may have stripped the object element.

It’s no surprise that “No” came out on top, with 60% of the vote, but 60% isn’t the overwhelming majority I would have guessed we would get. A full 40% said that yes, they have used multiple JavaScript libraries on the same page. Even with 27% saying yes without feeling guilty about it, I don’t think we had any compelling comments detailing a use case where that made sense. Which may have been because…

As usual, a flaw in the poll

The problem with this poll is that “JavaScript Library” wasn’t defined well enough. As I said above, what I meant by libraries in this poll was the general purpose libraries, but “library” can mean many more things. Twitter’s @anywhere is a JavaScript library, Modernizr is a JavaScript library, RaphaĆ«l is a JavaScript library. There is no problem at all with using these in conjunction with a general purpose library, so in this case using multiple libraries is no big deal at all. I’m sure this is what many folks had in mind when they voted for using multiple libraries.

Final Thoughts

If you have any final thoughts on the matter, say your peace. New poll this week sometime.