[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread T.J. Crowder
This made me think about lazy initialization of NodeListWrapper's. The two options seem to be: 1) store an array of pure elements and turn them into wrappers on the fly 2) turn elements into wrappers when instantiating `NodeListWrapper` and then return these (already prepared) wrappers.

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread kangax
On Aug 22, 7:14 am, T.J. Crowder [EMAIL PROTECTED] wrote: This made me think about lazy initialization of NodeListWrapper's. The two options seem to be: 1) store an array of pure elements and turn them into wrappers on the fly 2) turn elements into wrappers when instantiating

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread T.J. Crowder
NodeLists are live, though, aren't they?http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-.. Of course, but our selector implementation turns them into an array. Ah, okay, sorry about that. I was thinking live. I've read

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread kangax
On Aug 22, 9:09 am, T.J. Crowder [EMAIL PROTECTED] wrote: NodeLists are live, though, aren't they?http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-.. Of course, but our selector implementation turns them into an array. Ah, okay, sorry about that.  I was

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread kangax
On Aug 22, 10:33 am, John-David Dalton [EMAIL PROTECTED] wrote: T.J. $$W and $$ are the same thing (just named $$W so that we know we are talking about the new implementation). I kind of like the idea of lazy wrapping. That would speed up the initial selector while offering a one time hit

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread T.J. Crowder
When iterating over a `source` items, we don't know if an item is a wrapper or an element. My _each implementation deals with that case pretty efficiently. The ongoing runtime cost of item() and _each() is pretty much one extra comparison. Before we can do benchmarks, we should ask people

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread kangax
On Aug 22, 11:30 am, T.J. Crowder [EMAIL PROTECTED] wrote: I'm not sure if we should pre-wrap elements or do the lazy init. First approach hits the memory consumption, while second - run-time performance. We'll need benchmarks for this. Yeah.  I know you were initially thinking pre-wrap,

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread T.J. Crowder
@JDD: Sorry, missed your note in the melee. T.J. $$W and $$ are the same thing (just named $$W so that we know we are talking about the new implementation). Depending on how $$W is implemented, I may pretty strongly want Prototype's excellent selectors but without automatic element wrapping.

[Prototype-core] Re: Element wrapper draft notes

2008-08-22 Thread T.J. Crowder
@Ken: Of course an argument /against/ lazy wrapping is that we would have to make this.raw a private property because you wouldn't know if it contains wrapped or unwrapped elements. Yeah, that was my primary reason for keeping it separate; originally I was thinking integrated as well but I'm