When I get around to adding it, i'll add a community section to my company
homepage, with a few of these bits and pieces on there.
Til then, i think I have a blog (virtually never updated) somewhere, and I
could post them there. I'll make a spinoffs post on this when I add it.

Thanks for the tip on adding methods, I never thought to check for

1. agreed
2. $("myform").username works when the 'username' is static, and the use
case for non static names is very rare, so sounds fine.
3. I've used number.between a fair bit myself, and I seem to recall seeing
it recently in a library. Mainly in keyhandlers and drag/drop handling. but
yeah, it is easily accomplished with conditions.
4. Do you want me to create a patch for this? Last time I did it, I think I
used some code that allowed you to range dates by more than just day but
that's probably overkill. I think
Ken Snyder's date methods patch is here which I think has a better
implementation of Date.prototype.succ that allows more than just


On Nov 23, 2007 1:21 PM, Mislav Marohnić <[EMAIL PROTECTED]> wrote:

> On Nov 23, 2007 1:03 AM, Gareth Evans <[EMAIL PROTECTED]> wrote:
> > While possible features are being discussed, I have a 'get iframe
> > document object' function, and functions to set/get the caret position in an
> > input, and get [I haven't written set] the selection in a input.
> While maybe not a good fit for core (most of the users wouldn't use it),
> those seem definitely useful. I'll hope you'll still share them somehow
> (public dir in your svn repo is an option).
> > They're not implemented as prototypes currently since i havent managed
> > to figure out how to add extra methods to 'element' (since IE doesnt extend
> > automatically, i imagine its not Element.prototype.functionName = ... ),
> > and I dont really understand how to mix in my own methods to element without
> > modifying the prototype.js, I should really post to spinoffs to find out
> > this one :)
> Element.addMethods({
>   myAwesomeMethod(element, foo, bar) {
>     element = $(element);
>     /* your code ... */
>     return element; // allows chaining
>   }
> });
> You can also target specific elements:
> Element.addMethods('INPUT', { ... });
> Yeah, we know. It's awesome :)
> Re:
>    1. Array#sum - nice, but very easily implemented by users themselves
>    using #inject or a simple for loop. We generally add such small methods to
>    native prototypes like Function, Array etc. when we feel the need for it in
>    the library.
>    2. Findings inputs by name - definitely a real-world need, but
>    obtaining a reference is easily accomplished like this: 
> $("myform").username
>    3. Number.between - again, easily accomplished with conditions, and
>    the need for it is very rare (IMO) when looking at web applications in
>    general
>    4. Date.succ - enabling Date ranges? I say why not.
> >

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 [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to