I am working on a little class to create prototype-based overlays that
has gotten me thinking about prototype best practices. I am not trying
to ask questions regarding this particular implementation but use this
as an example to aid in discussing and answering the questions below.

First, here is the file I'm working with:


What I am trying to figure out is:

1. Is there a better way to handle callback definition? See lines
2. Is there a better way of referring to "body"? See line 33.
3. Is there a better way of "injecting" callbacks into functions so I
don't have to clutter methods like "on" and "off"? See lines 81, 91,
98, 108.
4. Is there a way to use prototype classes that take an element as
extensions to such element? Meaning, I would like to be able apply a
"click" observer to the instance of the class directly. Something

  `modal.observe("click", someHandler)`

and have that passed to the element to which the class is applied to.
In the class: `this.element` or in this example `modal.element`

Please let me know if my questions are not clear and I'll try to
expand on them. Also, feel free to fork and do your magic with the
code. I added some preliminary comments to guide you. I will fully
document this class after it's done.

Thank you!

PS: Note that I am using RC2.
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to