Welcome to the pulp javascript library

pUlp is like Prototype

Yes, pulp is one of those silly recursive acroynms.

pulp was created to equip developers to create small or large web applications using a friendly and powerful API.

pulp is quick, modular, and shares many concepts and method names with Prototype. Many Prototype plugins can be easily ported to pulp. In fact, for all intents and purposes, pulp is a fork of Prototype.

Why fork Prototype?

  • Prototype extends Array and Element and adds many variables to the global namespace.
  • Prototype is moving in a great direction by making plans to get away from extending Array and Element. But it is shackled by the need for backwards compatibility and it has baggage that won't be deprecated and removed for a long time.
  • There are many parts of Prototype that we don't use: Hash, Object Range, Form, Periodical Executer, Template, Timed Observer, Element creation. And we often don't use JSON.
  • We'd like to be able to use one or two parts of the library in a small project. For example, what if you just want Ajax? Or Element and Event? Or maybe just add Array and String methods to an existing application framework?
  • There are many methods in Enumerable and Element that aren't used very much. partition, zip, inGroupsOf, sortBy, eachSlice.
  • We'd like faster iteration in Enumerable methods. With Arrays, for example, calling "collect" calls "each" and "each" calls "_each". "invoke" adds another call because internally it calls "collect". View benchmarks.
  • We'd like to encourage lots of user contribution by making contribution easier.
  • We'd like an events system that:
    • has built-in support for observing custom object events
    • makes delegation first class
    • ensures FIFO order
    • allows developers to easily extend Events with custom methods
    • allows developers to easily plug-in observer variants such as mouseenter/mouseleave, wheel, click+shift
  • We'd like an inheritance system that uses Javascript prototyping and a base class to allow developers to extend all classes.
  • We'd like unit test files that include all the html, js, and fixtures used for the test.

Why not just use another library?

  • We'd like to be able to easily port our favorite Prototype-based scripts.
  • We love the Prototype API.
  • We find other libraries don't quite suit our needs.

So what can this thing do?

pulp mirrors the Prototype API for the most-used methods but is distinctive from Prototype in the following ways:

  1. pulp defines all official modules within the pulp namespace.
  2. pulp does not extend ANY native prototypes.
  3. Almost all pulp modules have no dependencies. pulp includes a class-creation system and several utility functions that all modules can make use of, but modules are otherwise independent. pulp does not "require" files on demand; a set of modules is compiled via the downloads page, and, in the future an on-demand script will be an option.
  4. All enumeration methods directly use for or while loops. pulp's each() method is up to 3 times faster than Prototype's. pulp's invoke() method is up to 5 times faster than Prototype's. View benchmarks.
  5. pulp encourages contribution by using a simple SVN repository that contains the source, documentation, and the pulp web site.
  6. pulp has a powerful class events system that handles before-action handlers, default-action handlers and after-action handlers. Documentation
  7. pulp uses traditional JavaScript prototypal inheritance.
  8. pulp allows exporting Array and String methods to browser-object prototypes.
  9. More

But does it work?

pulp javascript largely relies on test-driven development and includes comprehensive unit tests. pulp is currently in alpha phase, so some of the unit tests may not pass. pulp targets all major platforms and browsers back to IE6 and Safari 3.

View unit tests »

How do I try it?

See the downloads page!

So where do you see this going?

We have an aggressive roadmap to initial production release. Following the initial release, we hope to build a thriving community of developers using google code. Learn how to contribute.