Lil Flip ringtonesBoys Like Girls ringtonesChristina Aguilera ringtonesRighteous Brothers ringtones

JavaScript Libraries Playing Nice with Others?

A common occurrence in Web 2.0 sites, and one that a recent Pingdom study notes, is the concurrent use of multiple JavaScript libraries. One explanation for this is that a required (more often desired) feature or widget may appear to only be available within one specific library.

This perception may have been true a few years ago but is certainly less likely today. What's more likely is that a developer sees a real or perceived obstacle in implementing or developing a widget with one library over another. "Either the widget exists but I can't seem to install it or it's missing and I'm having trouble building it."

Either way, I'm beginning to develop more of a purist's view -- choose one framework for a project or environment and stick with it.

If a widget doesn't exist in a framework, I won't simply use another framework just to add it. Why you ask? Simplicity and performance. It's great that all of these JavaScript libraries reside in their own name space so as not to interfere with the others, but this makes it too easy to add unnecessary complexity and overhead to a site. 

I've developed a few sites that embed the Gallery Photo Manager in Drupal. At its core Gallery uses YUI while Drupal uses jQuery. To complicate matters I implemented a Script.aculo.us-based Lightbox effect. The use of Script.aculo.us introduced repetition in basic DOM handling functions that are already provided in YUI and jQuery. Although the repetition only adds up to a few extra kilobytes, these kilobytes add up.

I've decided to replace the effect with a YUI equivalent. One less library to complicate things and fewer file transfers to slow things down. What do you think? Are you using multiple JS libraries? Are you contemplating a JavaScript consolidation effort?

filed under:

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <codeblock> <blockquote> <h1> <h2> <h3> <h4> <h5> <img>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Use the special tag [adsense:format:group:channel] or [adsense:flexiblock:location] to display Google AdSense ads.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.