prototype.js just for AJAX

Wednesday, October 5th, 2005 at 12:07 +0000 (UTC) by Alexander Kirk

As I stated earlier, the prototype.js library is too large for just using AJAX. In its current version (1.4.0_pre10) it weighs 36KB and contains lots of other features that are most probably not needed when just dealing with AJAX.

I have therefore created a smaller version just for AJAX, based on 1.4.0_pre10: pt.ajax.js 8.9K

It now has only a quarter of size and still provides some nice features such as $ as a wrapper of document.getElementById.

Creating this was not too difficult: it is merely a combination of 4 files that make up prototype.js:

Just do copy and paste into a new files, i.e. copying each file to the bottom of your new javascript file.

As you can see, you can easily create your own customized (smaller!) version of prototype.js to fit your needs.

, ,

11 Responses to “prototype.js just for AJAX”

  1. ionut Says:

    10x this is a great ideea and for me that i'm a beginer at java is great. keep up the good work

  2. alexander kirk » Blog Archive » 10 Realistic Steps to a Faster Web Site Says:

    [...] Large page sizes are nowadays often caused by large JavaScript libraries. Often you only need a small part of their functionality, so you could use a cut-down version of it. For example when using prototype.js just for Ajax, you could use pt.ajax.js (also see moo.ajax), or the moo.fx as a script.aculo.us replacement. [...]

  3. Keenan Brock Says:

    This is great. You also mention Sack of ajax. Which one do you typically use?

    Also, you reference $R in base.js - so you may want to add that definition back.

    [also, I really liked your 10 Realistic steps ...]
    --K

  4. penis enlargement Says:

    I agree with you the way you view the issue. I remember Jack London once said everything positive has a negative side; everything negative has positive side. It is also interesting to see different viewpoints & learn useful things in the discussion.

  5. a free Orange | Links Says:

    Mini Prototype

    The Prototype library is too big just for Ajax (36kb). So Alexander Kirk's stripped it down precisely that purpose.Don't know if Scriptaculous will work properly with this, but I'm going bananas with this site if it does!...

  6. dncpax Says:

    Could you elaborate on how to build a custom lighter prototype lib?

    I can't find any info on this...

    Thanks,
    dnc

  7. Airabove | Online portfolio of swedish web designer and graphical artist Robert Arnesson Says:

    [...] Large page sizes are nowadays often caused by large JavaScript libraries. Often you only need a small part of their functionality, so you could use a cut-down version of it. For example when using prototype.js just for Ajax, you could use pt.ajax.js (also see moo.ajax), or the moo.fx as a script.aculo.us replacement. [...]

  8. XOOPS CHINA - WordPress » 10 Realistic Steps to a Faster Web Site Says:

    [...] Large page sizes are nowadays often caused by large JavaScript libraries. Often you only need a small part of their functionality, so you could use a cut-down version of it. For example when using prototype.js just for Ajax, you could use pt.ajax.js (also see moo.ajax), or the moo.fx as a script.aculo.us replacement. [...]

  9. eslam Says:

    It is very usefull i used it in blogger categories:http://blogger-categories.blogspot.com/

  10. manish Says:

    prototype is too hevey on the server so how we customize according to our requirement.

  11. Endre Says:

    36 kb ? i think it's more like 100Kb :)