[Prototype-core] Could some of Element's methods apply to all nodes?

2009-09-04 Thread Jim Higson
Let's say I want to get the paragraph containing the caret. I might have: var node = window.getSelection().getRangeAt(0).startContainer; // node is either Element or Text var para = (Object.isElement( node ) ? $(node).up( 'p' ) : $(no

[Prototype-core] A more efficient $super for Prototype 2

2009-09-04 Thread T.J. Crowder
Hi all, I've come up with a new way of handling $super (which I can't imagine is unique, it's just new to me) which is markedly more efficient than our current $super on all of the browsers I've tried it on. I'm wondering whether we should consider it for Prototype 2. Executive summary: Pros -

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread Robert Kieffer
Hey gang, I took a look at this issue a while ago, in a blog post that generated a fair bit of discussion and spin off investigations (see http://www.google.com/search?q=inheritance+performance+javascript) so I'll try to weigh in. However I'm in the middle of an extended road trip, so I don't hav

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread T.J. Crowder
Hi Richard, Thanks for that. I like the terseness and clarity of this.base() although I'd have concerns about that making it difficult for people to retrofit their classes ("base" being a fairly common word). I do _not_ mean that I think "callSuper" is a great name; I don't and I expect suggest

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread Allen Madsen
Hi, I think the speed improvement definitely merits going into. I would suggest the helper be called $super so when converting, the relationship is evident. I have to admit that passing arguments in feels odd to me though. Allen Madsen http://www.allenmadsen.com On Fri, Sep 4, 2009 at 9:09 AM, T

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread Jim Higson
On Friday 04 September 2009 14:09:32 T.J. Crowder wrote: > [...] I do _not_ mean that I > think "callSuper" is a great name; I don't and I expect suggestions > like yours to result in a better name. But something unlikely to > clash makes it simpler for people to do a global search-and-replace t

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread T.J. Crowder
@Allen & @Jim, Gets my vote. -- T.J. :-) On Sep 4, 3:05 pm, Jim Higson wrote: > On Friday 04 September 2009 14:09:32 T.J. Crowder wrote: > > > [...] I do _not_ mean that I > > think "callSuper" is a great name; I don't and I expect suggestions > > like yours to result in a better name.  But so

[Prototype-core] Copying arguments

2009-09-04 Thread T.J. Crowder
Hi all, In the 1.6.1 source, we're grabbing a reference to Array's `slice` method and then using that in a variety of places to copy subsets (or sometimes entire sets) of arguments, like so: var slice = Array.prototype.slice; //. ... function bind(context) { if (arguments.length < 2 &&

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread T.J. Crowder
Hi again folks, This thread[1] about using Array.prototype.slice to copy arguments made me wonder whether the speed improvements I found had more to do with the fact my implementation of the new mechanism had its own copy- the-args function (which is faster than using `slice` on most browsers; se

[Prototype-core] Odd Maruku errors whilst raking the docs.

2009-09-04 Thread Richard Quadling
Hi. ___ | Maruku tells you: +--- | Could you please format this better? | I see that " compatibility, through Number#succ." is left after the raw HTML

[Prototype-core] Re: Odd Maruku errors whilst raking the docs.

2009-09-04 Thread T.J. Crowder
Hi Richard, Yeah, see the PDoc mailing list[1]. Maruku is a no-go, too. :- ( Tobie's getting very frustrated (as am I). [1] http://groups.google.com/group/pdoc?lnk= -- T.J. Crowder tj / crowder software / com www.crowdersoftware.com On Sep 4, 4:59 pm, Richard Quadling wrote: > Hi. > >  

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread kangax
On Sep 4, 8:15 am, "T.J. Crowder" wrote: > Hi all, > > I've come up with a new way of handling $super (which I can't imagine > is unique, it's just new to me) which is markedly more efficient than > our current $super on all of the browsers I've tried it on. I'm > wondering whether we should con

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread T.J. Crowder
Hi Juriy, Thanks for that. Yes, it was the function decompilation (and the on- the-fly bind) that made me look for another solution. I was unaware of the performance implication of arguments.callee, and *WOW* does it make a speed difference (see below). The good thing is that this solution doe

[Prototype-core] Re: Copying arguments

2009-09-04 Thread Tobie Langel
We have a rewrite of function.js waiting to be included. It does something even smarter thanks to a great idea by Broofa. We'll add it in as soon as we've handled our pdoc and website issues. Best, Tobie On Sep 4, 5:03 pm, "T.J. Crowder" wrote: > Hi all, > > In the 1.6.1 source, we're grabbin

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-04 Thread kangax
On Sep 4, 2:54 pm, "T.J. Crowder" wrote: > Hi Juriy, > > Thanks for that.  Yes, it was the function decompilation (and the on- > the-fly bind) that made me look for another solution. > > I was unaware of the performance implication of arguments.callee, and > *WOW* does it make a speed differenc

[Prototype-core] Re: Copying arguments

2009-09-04 Thread kangax
On Sep 4, 7:39 pm, Tobie Langel wrote: > We have a rewrite of function.js waiting to be included. It does > something even smarter thanks to a great idea by Broofa. > > We'll add it in as soon as we've handled our pdoc and website issues. That patch looks good to go [1] (I think we all agreed on