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 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to