Prototype old documentation

36 views
Skip to first unread message

protobook

unread,
Nov 30, 2012, 12:20:53 PM11/30/12
to Prototype & script.aculo.us
This suddenly seems to have disappeared. It used to be at
http://www.prototypejs.org/api

I still look at it occasionally because there are things I can never
find in the current docs.
For example, could someone tell me where it explains about $break?
Thanks.
Ian

petrob

unread,
Dec 1, 2012, 4:17:24 AM12/1/12
to prototype-s...@googlegroups.com
The old documentation must have just been replace by the new one... The bigger problem is that the most recent one is still far the weakest part of the whole project, as it is laconic, incomplete, even faulty in some cases and it does not encourage any deeper understanding of the code base.  Just search for some keywords like 'error tickets / mistakes in the code base / in the documentation', and the like, and you will be quickly up-to date about it, but I will leave it now...

The need for using the $break object is based on how iteration is handled in Prototype in the 'each' method where any iterator functions are passed on to be called in the _each method in a  try- catch structure.
In this way any errors in any bad function calls at any depth are caught by the high level catch branch.. Because the native boiler- plate iteration always only takes place in the high-level scope of the  _each method, you will get an error if you try to call the break command in an embedded method to try to step out of the high-level loop as there is no iteration taking place in that deeper scope, at all. Instead, Prototype throws a special error object to do exactly that.

In the any method - for instance-
/*...cut...*/
    this.each(function(value, index) {
      if (result = !!iterator.call(context, value, index, this))
        throw $break;
    }, this);
/*...cut..*/
the $break object is thrown when the iterator function returns a boolean true value for the first element. The loop is broken and the result variable is returned. In the catch branch of each the special $break error object is recognized and evaluated to do nothing then.
catch (e) {
      if (e != $break) throw e;
    }


kstubs

unread,
Dec 1, 2012, 10:35:26 AM12/1/12
to prototype-s...@googlegroups.com
This is the link to the old documentation, which has been available for a long time but is no longer available

What I like more about the old documentation was there were better examples inline with the API code.  The new API, albeit a much better interface, is suited more for advanced coders I think.  

Now, having said that, there looks like some additional work has been done to these pages:

I have been working on an icon factory helper script, which, given an icon image sprite lets you pick an icon and gives you back the correct static icon factory get method for use in your code, and well I found the Measuring Elements and Offsets section very useful!
I think we should focus on expanding these articles and I think the API should reference these articles wherever possible.  

Karl..

Christophe Decaux

unread,
Dec 3, 2012, 5:09:04 AM12/3/12
to prototype-s...@googlegroups.com
I believe that what you are looking for is here:

http://prototypejs.org/doc/1.6.0/

Hope this helps

Christophe
> --
> You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
>

Reply all
Reply to author
Forward
0 new messages