views:

340

answers:

4

I am developing a mobile site that will load page content using AJAX if JavaScript is enabled. I have been using the JQuery load() functionality to load page contents from other static pages but I feel I am wasting precious bandwidth loading the entire JQuery library when I'm only using a small piece of it. With this said should we be avoiding libraries when only using small pieces of them?

A: 

If you are developing mobile web app, using AJAX, it means you are targeting users with smart phones and capable (and flaky) connection. I wouldn't be too concerned about including jQuery, but you may consider putting together small library with only functions you use. You can as well use GWT or Closure to optimize, compile and compress your JS during deployment time.

skrat
How would I go about putting together small library with only functions I want?
Brad
A: 

If you only need a simple XMLHttpRequest object you don't need any library. But if need some more fancy action like fade, slide or something else you should use some, because they get things done. Plan your project in the long term to see which requirements may occur.

toniL
A: 

Jquery is fairly small, (24kb), not to mention it's going to be cached most likely. (Even higher likely hood if you load it from the google library.)

path411
+1  A: 

i've experimented with xUI, a small jQuery-like javascript-library which is optimized (so; smaller & faster) for mobile use.

futtta