If you just need a basic JSONP (with callback), you might want to remove the
Ajax library in its entirety and just use a basic JSONP function.

For the rest, I would get your app working, and then start going through the
jQuery code commenting out whatever you don't think you're using. Then test
your app. You'll probably find a few things you commented out that you have
to put back in, but those are easy to spot. This is why you comment out code
rather than deleting it.

Watch out for silly syntax errors like extra commas or missing commas that
result from commenting out part of an object literal.

Any good programmers' editor should let you select a range of lines of code
and with a single keystroke comment or uncomment the entire range (or do the
same with a text selection within a line of code, using the appropriate
comment characters in each case). If your editor doesn't do this, go get the
free Komodo Edit:

http://www.activestate.com/Products/komodo_edit/

You could approach the Ajax plugin this same way, but it's complicated
enough that it would be hard to strip it down to a simple function call -
and JSONP only takes a dozen lines of code. See my ancient JSON plugin for
one example:

http://mg.to/2006/01/25/json-for-jquery

If you start from the uncompressed jquery-1.2.6.js on the website, watch out
for the exact point where the ajax plugin begins and ends - it's not exactly
on a line break. You can check out the code from svn and get the individual
files that go into jquery-1.2.6.js to see what's what.

Once you have the code commented out that you aren't using, run it through
Packer or JSMin, then GZip it, and see how you've done! All of the
commented-out code will be gone from your download.

-Mike

> From: me-and-jQuery
> 
> Well, in my case, I need JSON call not classic ajax. I know 
> other functionalities are simple in JS, but JSON call and 
> sliding is a must.
> Max file can be 5-10 kb from my calculations.
> 
> What about removing functions from jQuery library which I 
> don't need and have no effect on "engine" and needed 
> functionality? Do you have any experience with that?
> 
> Thanks in advcance.

Reply via email to